Article View: comp.editors
Article #1376Help wanted with sed.
From: William Warburton
Date: Fri, 13 Nov 1992 18:09
Date: Fri, 13 Nov 1992 18:09
21 lines
1076 bytes
1076 bytes
Hi, Can anyone tell me how to get sed to copy more than two lines into the pattern space? I want to get the pattern space to include about 5-30 lines and then write it out to one of two files according to the last part of the pattern. I envisage something like this: /start_of_context/,/end_of_context/N /.*\nLastLine/w out_file_1 /.*\nLastLine/!w out_file_2 However the first line of the program just joins pairs of lines. I have managed to get three lines joined by using N twice but I can't work out how to extend this for the general case. Help! Thanks for your advice, W. +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
Technical Details
Message-ID:
<28138@castle.ed.ac.uk>Path:
arc1-ca.pugleaf.net!sparky!uunet!ukma!usenet.ins.cwru.edu!agate!doc.ic.ac.uk!uknet!edcastle!williamShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ukma!usenet.ins.cwru.edu!agate!doc.ic.ac.uk!uknet!edcastle!william From: william@castle.ed.ac.uk (William Warburton) Newsgroups: comp.editors Subject: Help wanted with sed. Message-ID: <28138@castle.ed.ac.uk> Date: 13 Nov 92 18:09:46 GMT Sender: nntpusr@castle.ed.ac.uk Reply-To: W.Warburton@ed.ac.uk Organization: Edinburgh University Computing Service Lines: 21