[Cialug] sed -e -e
Nicolai
nicolai-cialug at chocolatine.org
Thu May 9 14:49:51 UTC 2019
On Wed, May 08, 2019 at 12:05:11PM -0500, Jeffrey Ollie wrote:
> You could use:
>
> (pattern1.*pattern2)|(pattern2.*pattern1)
>
> but that would fail if it's possible for the patterns to overlap.
>
> Sed can do it though:
>
> cat file | sed -e '/pattern1/!d' -e '/pattern2/!d'
>
> That should output only lines from "file" that contain both patterns.
Sigh, don't know how I missed this. I must gotten some insanely bad
sleep last night. Should probably not operate any heavy unix machinery
today. Sorry for the noise!
Nicolai
More information about the Cialug
mailing list