Posts Tagged ‘grep’
I want to filter log files by matching lines that contains all of set of matches (I don’t want to alternate them).
For example lines like:
I want to match lines that contain the terms “RawURL” and “/1.2/user/authorize?” without resorting to piping multiple greps:
$ grep RawURL | grep /1.2/user/authorize? *.txt
This means I want a regexp like:
Translating to grep extended regex, this becomes:
$ grep -E RawURL.+/1.2/user/authorize *.txt
Note: There is no need to enforce non-greedy matching.
Regular expressions, character classes and special characters
Is not equivalent to:
Because in the second one, the special character ‘.’ is no longer special. Character classes have all special characters turned off.