|
Re: Post-grep-like operations: msg#00044editors.sed.user
*grumble* This was supposed to go to the list, not straight to Rob. Gmail does not like certain mailing lists for some reason. On 12/10/05, Rob Simpson <Rob.Simpson@xxxxxxxxxxxxx> wrote: > > I am wanting to select lines containing 'fruit' or 'veg', and then carry out > some operation on them, say substitution X for a. <SNIP> > I am trying to do this in a sed file: > > /fruit/b > /veg/b > d > s/a/X/g > > using the grep like command in the one-liners document. > > The last expression doesn't get carried out. I guess something is happening > with the buffer, but do not understand what. I can't find '/b' in the > documentation. >From the man page on my system: [2addr]b[label] Branch to the ``:'' function with the specified label. If the label is not specified, branch to the end of the script. So b will either branch to the end of the file or to a label. Your script is branching to the end of the file since there is no label. Add a label, say sub, right after the b and then add a label, :sub:, on a line before the substitution command. Your script will then look like this: /fruit/bsub /veg/bsub d :sub s/a/X/g When searching man pages some times it pays to read them instead of searching for a string. There is a large quantity of useful information in most man pages that you will miss if you just search for strings. -- Lorance Stinson http://www.flickr.com/photos/lorancestinson/ http://lorance.freeshell.org/ ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/dkFolB/TM --------------------------------------------------------------------~-> -- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/sed-users/ <*> To unsubscribe from this group, send an email to: sed-users-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Post-grep-like operations: 00044, Rob Simpson |
|---|---|
| Next by Date: | Re: Post-grep-like operations: 00044, Joel Hammer |
| Previous by Thread: | Post-grep-like operationsi: 00044, Rob Simpson |
| Next by Thread: | Re: Post-grep-like operations: 00044, Joel Hammer |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |