Re^2: Sed -- deleting to line BEFORE regexp match

Maarten Litmaath maart at cs.vu.nl
Thu Feb 23 11:08:32 AEST 1989


leo at philmds.UUCP (Leo de Wit) writes:
\sed "
\/^diff/{
\    : again
\    /new_file1$/b del
\    /new_file2$/b del
\
\       (etc.)
\
\    /new_fileN$/b del
\    b nodel
\    : del
\    n
     ^
     questionable

\    /^diff/b again
\    b del
\    : nodel
\}"

Huh? From `man sed':

     (2)n Copy the pattern space to the standard output.  Replace
          the pattern space with the next line of input.

You don't want the pattern space on the standard output. My previous article
showed a solution using sed's `-n' option.
-- 
 "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