[Cialug] sed -e -e

Todd Walton tdwalton at gmail.com
Wed May 8 16:02:55 UTC 2019


It looks to me like if I run a sed command with multiple "-e" scripts,
each one applies in turn. If I add a line that says "blah blah" with
one "-e", and then a subsequent "-e" replaces "blah" with "yak", I'll
end up with text that says "yak yak". I was wondering if each one
applied in turn, or if each one operated on the original text, or
what. But it seems to be that it's basically adding each "-e" as a
line to a full script.

As an aside, I sometimes wish I could do that with grep, instead of
using pipes. Like, grep a file for lines that contain "pattern1" *and*
"pattern2": grep -e "pattern1" -e "pattern2" file

--
Todd


More information about the Cialug mailing list