grep with regular expression

The following command helped me to search through a very large log file and find matching entries using a regular expression

grep -E --only-matching 'GET /some/path/([A-Za-z0-9?=&_/\-]*)' access.log > result.txt

“-E” will tell grep to use extended regular expressions
“only-matching” will return only the matching string and not the whole line
The optional “> result.txt” will save the output to a text file.

In this special case the regex matches all GET requests to “/some/path” including all parameters. It will match until the white space that follows the URL.

A single golf clap? Or a long standing ovation?

By clapping more or less, you can signal to us which stories really stand out.