Printing lines between BEGIN and END

John Pierce jwp at chem.ucsd.edu
Sun Apr 24 11:14:25 AEST 1988


awk '/^BEGIN$/,/^END$/ {if($1 !~ /^BEGIN$/ && $1 !~ /^END$/) print}' filename

sed -e '1,/^BEGIN$/d' -e '/^END$/,$d' filename

The sed script has the flaw that there must be at least one line preceding
the BEGIN line.

-- 
   John Pierce	Chemistry, B-032, UCSD, La Jolla,  CA 92093
		jwp at chem.ucsd.edu  jwpierce at ucsd  +1 619 534 0203



More information about the Comp.unix.wizards mailing list