$ cat access_log | perl -pe 'if (s/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}).*"(GET|POST|HEAD) (.*?) HTTP\/.*$/$1,$3/) { print } else { print STDERR }' 2>out.err > out.csv