Re^3: Sed -- deleting to line BEFORE regexp match
Leo de Wit
leo at philmds.UUCP
Sun Feb 26 21:15:27 AEST 1989
In article <2087 at solo9.cs.vu.nl> maart at cs.vu.nl (Maarten Litmaath) writes:
|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.
Slip of the finger, I think. Mine should also have used '-n', in which
case 'n' will not copy implicitly, as you probably are aware of.
Leo.
P.S. Interesting side issue: is it always possible to convert sed
scripts that are designed for use with '-n', to scripts not using '-n',
and vice versa? If so, design a program (of course preferably a sed
script 8-) to do so.
More information about the Comp.unix.questions
mailing list