home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
300-399
/
ff319.lzh
/
CNewsSrc
/
cnews.orig.lzh
/
relay
/
sh
/
tear
< prev
Wrap
Text File
|
1989-06-27
|
528b
|
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]|[^ \t]*:)/ { print >hdr; next }
{ inbody = 1; print >body }
' hdr="$hdr" body="$body" $args