sed -f Script Syntax
Warren Block
wblock at wonkity.com
Thu Dec 17 04:04:34 UTC 2009
On Wed, 16 Dec 2009, Martin McCormick wrote:
> Warren Block writes:
>> sed(1) says it should be -E. Looks like it will only work on the whole
>> script.
>
> Many thanks. I have had -e work many times
But -e does not mean what you think here:
-E Interpret regular expressions as extended (modern) regular
expressions rather than basic regular expressions (BREs). The
re_format(7) manual page fully describes both formats.
-e command
Append the editing commands specified by the command argument to
the list of commands.
So sed -E means "interpret regular expressions as extended" and -e is
followed by a command:
sed -E -e 's/a/b/' -e 's/x/y/'
> if you call sed from either the command line or a shell script as in
>
> sed -f somefile
>
> with somefile being 1 or more lines of sed commands. When the
> file itself is the script, the first line actually calls sed
> from within the file.
I'm not clear on why you want to do it that way instead of simply
calling sed from a shell script, but sed -Ef seems to do what you want.
-Warren Block * Rapid City, South Dakota USA
More information about the freebsd-questions
mailing list