sed -f Script Syntax

Warren Block wblock at wonkity.com
Thu Dec 17 00:12:08 UTC 2009


On Wed, 16 Dec 2009, Martin McCormick wrote:

> If you have a sed script that is executable as in the first line
> starts with
> #! /usr/bin/sed -f
> and the following lines are like:
>
> /this repetitive line/d
> /and another repetitive line to go/d
>
> This all works great. You just make the file executable and use
> it as a filter if you want to remove any instance of those lines
> in text.
>
> 	How does one embed a command in this filter to make sed
> understand an extended or modern regular expression like:
>
> /part 1[[:space:]]text\/html[[:space:]]/d
>
> This is normally the -e flag but I haven't figured out how to put it 
> in the script.  I would like to either use it to make that one line 
> show up as an extended regular expression or make sed run the entire 
> script in the -e mode.

sed(1) says it should be -E.  Looks like it will only work on the whole 
script.

-Warren Block * Rapid City, South Dakota USA


More information about the freebsd-questions mailing list