You're replying to a comment by Peter Krumins.

June 27, 2012, 19:27

Your reasoning is correct, and your program is actually correct.

The only problem is with the type of regular expressions sed uses. It uses so called "basic" regexes where | is an ordinary character.

You've to escape it to make it work like an alternation operator:

sed -e '/AAA\|BBB/!d;/CCC/!d'

Try this and it will work.

Also check out the -r argument to sed. It enables extended regular expressions, and your program will work:

sed -re '/AAA|BBB/!d;/CCC/!d'

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "halflife3_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.