Path: utzoo!mnetor!uunet!husc6!rutgers!mtunx!lzaz!lznv!jlw From: jlw@lznv.ATT.COM (j.l.wood) Newsgroups: comp.unix.wizards Subject: Re: A little help with SED please - cla Message-ID: <1367@lznv.ATT.COM> Date: 21 Apr 88 21:42:14 GMT References: <5490@sigi.Colorado.EDU> <142700030@occrsh.ATT.COM> Organization: AT&T ISL Middletown NJ USA Lines: 65 Summary: Simpler awk line In article <142700030@occrsh.ATT.COM>, rjd@occrsh.ATT.COM writes: > > :I need an sed line (or some gory pipeline) to extract the data between > ^^^^^^^^^^^^^^^^^^^^^^ > :BEGIN and END. > : > :I should have added the following: > : > : >I have a text file of this form: > : [... junk ...] > : > BEGIN > : > 1 > : > 2 > : > 3 > : > END > : [... junk ...] > : > BEGIN > : > 4 > : > 5 > : > 6 > : > END > : [... junk ...] > > Is "awk" gory enough??? :-) Here's an awk script: > > cat | awk -f script > > where 'script' is a file containing this: Some Stuff Deleted: The following awk command line seems to do what you want: cat |\ awk '/BEGIN/,/END/ { if( $0 != "BEGIN" && $0 != "END" ) print }' Joe Wood lznv!jlw I n e w s f o d d e r m o r e f o d d e r