easy for some
Root Boy Jim
rbj at uunet.uu.net
Sat May 18 04:38:27 AEST 1991
In article <6686 at male.EBay.Sun.COM> matthew at gizmo.UK.Sun.COM (Matthew Buller - Sun EHQ - MIS) writes:
>
>I am fairly new to unix, and I have a minor question:-
>problem: to extract text between start and end patterns in a file
>
>I have tried to grok the man page for `sed' but no luck.
Try a bit harder. Or buy a book such a "Sed & Awk" from O'Reilly
& Associates. In the meantime, here is the solution:
sed -n '/pat1/,/pat2/p'
also sed '/pat1/,/pat2/!d'
Be aware that this will select all non-overlapping ranges,
so you may get more than you want.
Basicly, all the lines in the sed 'program' are executed on
every line of the input file. It's really pretty simple.
However, my eyes glazed over the first
time I read the words "pattern space".
--
[rbj at uunet 1] stty sane
unknown mode: sane
More information about the Comp.unix.internals
mailing list