Simple question...

J Greely jgreely at oz.cis.ohio-state.edu
Sun Dec 3 02:18:08 AEST 1989


In article <3013 at uceng.UC.EDU> schriste at uceng.UC.EDU
 (Steven V. Christensen) writes:
>Excuse the simple question, but I have a bunch of shar files that
>I want to unshar. Unfortunately all 20+ have the mail headers on them.
>In SED, how would I pipe the files to remove everything before the
>"#!/bin/sh" ?

Strictly speaking, you need to remove everthing before the first line
that begins with either "#" or ":", since many shar programs produce
the latter.

	sed -n '/^[#:]/,$ p'

is the command you're looking for.

> Also, how would I get everything between the "#!/bin/sh"
>and the "exit 0" at the end (for those mailers which append a .sig)?

You don't.  The "exit 0" is there specifically to prevent the shell
from reading the signature.


Of course, to beat a dead horse, you can do it in perl like this:
	perl -ne 'print if /^[#:]/..eof();'
-=-
J Greely (jgreely at cis.ohio-state.edu; osu-cis!jgreely)



More information about the Comp.unix.questions mailing list