Occasionally, you want to find all the lines in a file which have either 'eng', or 'net', or 'ide' in them.
You think "I know, I'll use regular expressions".
Now, you have three problems. The one you weren't expecting is grep's weird syntax for regular expressions.
This subject is both deep and boring. Suffice it to say that:
grep 'eng\|net\|ide'
is an answer
grep -E 'eng|net|ide'
and
ack 'eng|net|ide'
is an answer.
If you really want to know the details, look up 'basic regular expressions', 'extended regular expressions', and 'perl-compatible regular expressions'.
Monday, September 22, 2014
Subscribe to:
Posts (Atom)