home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gold Fish 1
/
GoldFishApril1994_CD2.img
/
d4xx
/
d473
/
cnewssrc
/
cnews_src.lzh
/
relay
/
sh
/
tear
< prev
Wrap
Text File
|
1990-05-28
|
551b
|
26 lines
#! /bin/sh
# tear prefix [file...] - tear RFC822 header and body apart
# output files are $1hdr and $1body
PATH=/bin:/usr/bin; export PATH
case $# in
0)
echo "usage: tear prefix [file...]" >&2
exit 1
;;
esac
hdr="$1hdr"
body="$1body"
shift
>>$hdr # create files just in case
>>$body
case $# in
0) args="-" ;; # awk needs a filename due to cmd. line assignments
*) args="$@" ;;
esac
exec awk 'inbody == 0 && ($0 ~ /^[^ \t]*:/ || ($0 ~ /^[ \t]/ && NR > 1)) { print >hdr; next }
{ inbody = 1; print >body }
' hdr="$hdr" body="$body" $args