Xref: utzoo comp.unix.questions:6686 comp.unix.wizards:7986 Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!ucsd!chem.ucsd.edu!jwp From: jwp@chem.ucsd.edu (John Pierce) Newsgroups: comp.unix.questions,comp.unix.wizards Subject: Printing lines between BEGIN and END Message-ID: <181@chem.ucsd.EDU> Date: 24 Apr 88 01:14:25 GMT References: <5490@sigi.Colorado.EDU> <1417@laidbak.UUCP> Reply-To: jwp@chem.ucsd.edu (John Pierce) Distribution: na Organization: Chemistry Dept, UC San Diego Lines: 9 Summary: Only takes one line of sed or awk 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@chem.ucsd.edu jwpierce@ucsd +1 619 534 0203