4

man sed says:

-e script, --expression=script
          add the script to the commands to be executed

The description on gnu.org says:

`-e SCRIPT'
`--expression=SCRIPT'
 Add the commands in SCRIPT to the set of commands to be run while
 processing the input.

What does that mean? What would be the difference between a sed command with and without -e?

I'm trying to learn about sed

2

Using -e you can run multiple sed scripts with one command, like

sed -e /23/d -e s/foo/bar/

(delete any line containing 23 and replace foo with bar)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.