Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!pasteur!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!mcvax!hp4nl!philmds!leo From: leo@philmds.UUCP (Leo de Wit) Newsgroups: comp.unix.questions Subject: Re^3: Sed -- deleting to line BEFORE regexp match Message-ID: <961@philmds.UUCP> Date: 26 Feb 89 11:15:27 GMT References: <3296@uhccux.uhcc.hawaii.edu> <957@philmds.UUCP> <2087@solo9.cs.vu.nl> Reply-To: leo@philmds.UUCP (Leo de Wit) Organization: Philips I&E DTS Eindhoven Lines: 39 In article <2087@solo9.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes: |leo@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.