[HPADM] SED Question :-)

From: Deepak John Cutinha (deepak_cutinha@yahoo.com)
Date: Wed Oct 16 2002 - 08:47:31 EDT


Dear Unix gurus!!

I'm studying the sed utility to do some text
manipulation for source files.

Taking an example file called 'datafile' :

Taking an example file called 'datafile' :
northwest NW Charles Main 3.0 .98 3 34
western WE Sharon Gray 5.3 .97 5 23
southwest SW Lewis Dalsass 2.7 .8 2 18
southern SO Suan Chin 5.1 .95 4 15
southeast SE Patricia Hemenway 4.0 .7 4 17
eastern EA TB Savage 4.4 .84 5 20
northeast NE AM Main Jr. 5.1 .94 3 13
north NO Margot Weber 4.5 .89 5 9
central CT Ann Stephens 5.7 .94 5 13
xxxxxxxxx above lines are repeated xxxxxxxxx
northwest NW Charles Main 3.0 .98 3 34
western WE Sharon Gray 5.3 .97 5 23
southwest SW Lewis Dalsass 2.7 .8 2 18
southern SO Suan Chin 5.1 .95 4 15
southeast SE Patricia Hemenway 4.0 .7 4 17
eastern EA TB Savage 4.4 .84 5 20
northeast NE AM Main Jr. 5.1 .94 3 13
north NO Margot Weber 4.5 .89 5 9
central CT Ann Stephens 5.7 .94 5 13
xxxxxxxxx end of file xxxxxxxxx

I want to delete the line starting with eastern, and
the next 2 lines (whatever they may be).

I tried this command in a script file:

scriptfile:
/eastern/d
$d
$d

..and gave the command:

sed -f scriptfile datafile

... but it does not work (because $d matches any
newline, not the next two after 'eastern' ) Any clues
how to do it?

Thanks

Deepak

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
             ---> Please post QUESTIONS and SUMMARIES only!! <---
        To subscribe/unsubscribe to this list, contact majordomo@dutchworks.nl
       Name: hpux-admin@dutchworks.nl     Owner: owner-hpux-admin@dutchworks.nl
 
 Archives:  ftp.dutchworks.nl:/pub/digests/hpux-admin       (FTP, browse only)
            http://www.dutchworks.nl/htbin/hpsysadmin   (Web, browse & search)


This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 11:02:21 EDT