Regex to pull GET POST commands from apache logs
The regex:
perl -p -i -e 's/^.*\s\"(GET|POST)(.*)\"\s.*\".*\".*\"$/\1\2/'
Will extract:
GET /bitstream/34171/1/sp06pa01.pdf HTTP/1.1
GET /bitstream/34171/1/sp06pa01.pdf HTTP/1.1
from
99.239.52.187 - - [21/Sep/2008:09:38:24 -0500] "GET /bitstream/34171/1/sp06pa01.pdf HTTP/1.1" 200 16368 "http://www.google.ca/search?hl=en&q=positive+effects+on+canada+from+immigration&start=10&sa=N" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.1) Gecko/2008070208 Firefox/3.0.1"