📝 Edit on GitHub
Extended
About using grep's extended matching
About
Basic grep already supports some patterns, like glob and regex.
To extend the matching to be more powerful, you can use extended grep.
Usage
egrep PATTERN PATH
Or grep -e
in place of egrep
.
Examples
$ egrep "support|help|windows" myfile.txt
$ egrep '^[a-zA-Z]+$' myfile.txt
$ egrep -c '^begin|end$' myfile.txt
Note that brackets are not needed in the simple case.
$ egrep 'Foo bar|baz: ' myfile.txt
$ egrep '(Foo bar)|(baz: )' myfile.txt
But are meaningful here:
$ egrep -H '[^0] to (add|destroy)' *