Grep | Powershell Search | Regex

Powershell

Search for string text and display it in a list in the selected path

Get-ChildItem -Recurse | Select-String "string_you_need_to_find" -List | Select Path

Bash | Command Shell

Grep is a cool command for doing log analysis -> can search and pipe to many stuff

grep -iE -A3 'strings_you_need_to find' <the_files> 

Grep URL

Search for URL in the log file, sort -u is to remove duplicate

grep -o "(http|https)://[a-zA-Z0-9./?=_%:-]*" <file> | sort -u 

grep -o "(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?" <file> | sort -u

# Find endpoint
cat main.js | grep -oh "\"\/[a-zA-Z0-9_/?=&]*\"" | sed -e 's/^"//' -e 's/"$//' | sort -u

Regex Patterns

Key Pattern

Use this when there a big file which you guess that would have anything key related stuffs

Last updated

Was this helpful?