Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am trying to understand a shell script that uses sed. I found that there were some places where sed was invoked with the -e option.

I tried to see the man page and it just mentions,

-e command

Append the editing commands specified by the command argument to the list of commands.

which is not very clear to me.

Can someone kindly explain to me what the -e does? Thanks.

PS: I am using sed in mac

share|improve this question

migrated from stackoverflow.com Apr 15 '13 at 11:56

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 4 down vote accepted

The -e parameters tells sed that you wish to supply multiple commands:

sed -e 's/string1/string2/g' -e 's/string4/string5/g'

This will replace string1 with string2 and string4 with string5.

share|improve this answer
    
Thanks. That explains it. Now the cryptic message in the man command makes sense. –  Sudar Apr 15 '13 at 11:06
    
:-) glad to be of help –  Sean Landsman Apr 15 '13 at 11:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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