[Cialug] sed -e -e

Charles Dunbar ccdunbar at gmail.com
Wed May 8 16:19:36 UTC 2019


>
> 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


Good news!

`egrep "pattern1|pattern2" file`
`grep -E "pattern1|pattern2" file`

Charles

>
>

On Wed, May 8, 2019 at 11:04 AM Todd Walton <tdwalton at gmail.com> wrote:

> 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
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> https://www.cialug.org/cgi-bin/mailman/listinfo/cialug
>


More information about the Cialug mailing list