Sed -- deleting to line BEFORE regexp match

Maarten Litmaath maart at cs.vu.nl
Tue Feb 21 05:16:36 AEST 1989


lupton at uhccux.uhcc.hawaii.edu (Robert Lupton) writes:
\...
\Also, I couldn't make this work using csh (it complains about unmatched "),
\only with the Bourne shell.

Welcome to csh! Its quoting conventions are a BIT different, RTFM.

\Any comments? What I want is "/^diff new_file/,(/^diff/-1)d", but that
\ain't sed.

sed -n '/^diff new_file/{
		:L
		n
		/^diff/!b L
	}
	p'
-- 
 "Those who do not understand Henry     |Maarten Litmaath @ VU Amsterdam:
Spencer are condemned to reinvent DOS." |maart at cs.vu.nl, mcvax!botter!maart



More information about the Comp.unix.questions mailing list