home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d473
/
cnewssrc
/
cnews_src.lzh
/
relay
/
anews
/
b.to.a
< prev
next >
Wrap
Text File
|
1989-10-14
|
798b
|
36 lines
#! /bin/sh
# bnewstoa: B-format news to A-format converter (why, oh, why?) (thanks, Norman)
PATH=/bin:/usr/bin:/usr/ucb; export PATH
awk '
NR==1,/^$/ { # headers: save A headers only
if ($0 ~ /^Message-ID: /)
msgid=$2
else if ($0 ~ /^Newsgroups: /)
ngs=$2
else if ($0 ~ /^Path: /)
path=$2
else if ($0 ~ /^Date: /) {
date = $2 # skip "Date:"
for (i = 3; i <= NF; i++)
date = date " " $i # append remaining fields
} else if ($0 ~ /^Subject: /)
subj=$2
else if ($0 ~ /^$/) { # end of headers: spew out A-format equivalent
print "A" msgid
print ngs
print path
print date
print subj
inbody = "yes"
noblanksyet = "yes"
}
}
inbody=="yes" { # copy body except first blank line, if present
if ($0 ~ /^$/ && noblanksyet == "yes")
noblanksyet = "no"
else
print
}
'