Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SED command help

Status
Not open for further replies.

Smithy999

Programmer
Jan 11, 2005
1
GB
I need a command that will search through a file and where it finds the marker %%BeginPageSetup then I want it to delete anything between the markers %%BeginFeature and %%EndFeature. There will be multiple occurrances of the Begin and End.

I have found a sed script that is supposed to do this but it is erroring, the script is below:

/^%%BeginPageSetup/,$ {

/^%%BeginFeature/,/^%%EndFeature/d

}

A sample of the file that I want this to work on is below:

%%Page: 1 1
%%BeginPageSetup
%%BeginFeature: *PageSize A4

%%EndFeature
%%BeginFeature: *InputSlot Upper
0 statusdict /setpapertray get exec
%%EndFeature
0 0.000 -3508.333 0 75.000 75.000 1.000 1.000 IP
%%EndPageSetup

After the command it should look like this:

%%Page: 1 1
%%BeginPageSetup

0 0.000 -3508.333 0 75.000 75.000 1.000 1.000 IP
%%EndPageSetup

Thanks and Regards

Mark.
 
This sed script works for me:
/^%%BeginPageSetup/,/^%%EndPageSetup/{
/^%%BeginFeature:/,/^%%EndFeature/d
}

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top