Parsing HTTP records (one-liner)

Extracting tripples (host, referrer, GET) from HTTP connection packets (prints stuff on “.”).

perl -ne ‘$get = $1 if /^GET ([^\s]) /; $host = $1 if /^Host: ([^\s])/; $ref=$1 if /^Referer: ([^\s]*)/; if (/^.$/) { print “ID, $host, $get, $ref\n”;}’

Leave a Reply