Skip to content

Instantly share code, notes, and snippets.

@kalpesh-fulpagare
Last active August 26, 2019 09:07
Show Gist options
  • Save kalpesh-fulpagare/3e8057fa9c712a7327419a5868a11e24 to your computer and use it in GitHub Desktop.
Save kalpesh-fulpagare/3e8057fa9c712a7327419a5868a11e24 to your computer and use it in GitHub Desktop.
Grep Search
# Find requests for a Device/API
LOGFILE="log/development.log"
OUTPUT=$(grep -an 'Started PUT "/api/v1/users/information' $LOGFILE | grep -o "........-....-....-....-............" | awk 'ORS="|"')
OUTPUT=${OUTPUT%?};
echo $OUTPUT
OUTPUT=$(egrep -an $OUTPUT $LOGFILE | grep 'userid => 15841' | grep -o "........-....-....-....-............" | awk 'ORS="|"')
OUTPUT=${OUTPUT%?};
echo $OUTPUT
egrep -an $OUTPUT $LOGFILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment