[Cialug] sed -e -e

Nicolai nicolai-cialug at chocolatine.org
Thu May 9 14:43:55 UTC 2019


On Wed, May 08, 2019 at 12:02:55PM -0400, Todd Walton wrote:
> 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

$ cat names.txt
alice orange
bob orange
orange juice
gin and juice
$ grep -E 'orange.*juice' names.txt
orange juice
$ awk '/orange/ && /juice/' names.txt  
orange juice

https://www.shellhacks.com/grep-or-grep-and-grep-not-match-multiple-patterns/

TIL!
Nicolai


More information about the Cialug mailing list