Skip to content
Advertisement

Extract all unique URL from log with only POST type of the request

I’ve got a log file with the such type of the records:

41.201.181.27 - [2019-04-06 18:22:02] "GET /images/stands/photo_mois.jpg HTTP/1.1" 304 - "http://example.com/popup.php?choix=mois" "Mozilla/4.0" "-"

I’ve got the script for getting all records with unique URLs: cut -f4 -d" < logfile | sort -u How i need to change it for getting unique URLs with only POST type of the request?

Advertisement

Answer

You can always pipe to cut command. Something like below

grep POST /path/to/myfile.log | cut -f4 -d"  | sort -u
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement