Skip to content

Instantly share code, notes, and snippets.

@codeasashu
Created April 8, 2019 08:23
Show Gist options
  • Save codeasashu/78c6962223a78a3c3ef40c153952588f to your computer and use it in GitHub Desktop.
Save codeasashu/78c6962223a78a3c3ef40c153952588f to your computer and use it in GitHub Desktop.
Some better Regexes
1. Extract all (PHP) requests from apache access.log:
grep -Eo '"POST /[a-zA-Z0-9_ ]+/[a-zA-Z0-9_]+.php HTTP/1.1"' access.log
2. find all urls in a folder across all files:
grep -rnEo "(http|https)://[a-zA-Z0-9./?=_-]*" folder/
3. SED delete range of lines in a huge text files:
sed -i '21,141d' file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment