Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!ubc-vision!alberta!obed!stephen From: obed!stephen@alberta.UUCP (Stephen Samuel) Newsgroups: comp.sources.d Subject: Re: File headers on shar files Message-ID: <966@pembina.UUCP> Date: 8 Dec 87 21:12:46 GMT References: <393@ddsw1.UUCP> <252@papaya.bbn.com> Organization: U. of Alberta: Biochemistry , Edmonton, AB Lines: 29 Summary: a short unshar program that works for most cases. In article <252@papaya.bbn.com>, rsalz@bbn.com (Rich Salz) writes: > In turgid prose, someone writes: .... > #that preceeds the shar into the file in such a way that it will not > #interfere with the attempts of myself (and I bet others as well) to automate > #or simplify this unpacking. This can be assured by simply insuring that the > #first character of each line is a "#", making it a shell comment line. > The following is a quick file to do un-sharing of messages and articles. It simply eats everything up to (but not including) the first comment line (I have yet to see a shar file that doesn't have at least one). the rest gets stuffed thru your favorite shell. Although the default program to do the screening is sed I have included an awk version because it seems that the Convergent Mightyframe has some sort of bug with sed that caused it to EAT CPU TIME (90% system cpu) FOR LUNCH!!! (hint, hint, CT...). # ----------------- CUT HERE ----------------- # # file bin/toshar sed -e 's/^\>//' -e '/<$/s/\<$//' << "++ENDFILE++" > bin/toshar >PROG=sh >for i in $@ >do >echo start $i ># awk -e '/^[#:]/,0==1' $i | $PROG >sed -n -e '/^[#:]/,$p' $i | $PROG >echo done $i >done ++ENDFILE++