sed question

Dr A. N. Walker anw at maths.nott.ac.uk
Tue May 21 20:57:28 AEST 1991


In article <1991May17.002433.15615 at vpnet.chi.il.us> dattier at vpnet.chi.il.us
(David W. Tamkin) writes:

> sed -n '/PATTERN1/,/PATTERN2/p
> /PATTERN2/q' filename

Try

	sed '/PATTERN1/,$ !d; /PATTERN2/ q' filename

which works even if PATTERN2 happens to occur before PATTERN1, and
which mentions PATTERN2 only once [less to maintain!].

-- 
Andy Walker, Maths Dept., Nott'm Univ., UK.
anw at maths.nott.ac.uk



More information about the Comp.unix.shell mailing list