Log parsing

I have a directory with daily logs that have records like this:

Date: 04/17/13	Time: 09:29:15
IP: 123.123.123.123
URL: usr/local/file1

and I want to only count how many times each file was accessed (e.g. file1 in that example above), and I want to also look in all the logs in the current folder, not only the log for today. Is there a one liner that can do all this? sample output I'm looking for:

file1 13
file2 7
file3 145
...
and so on
awk -F'/' '/URL/{A[$NF]++}END{for(k in A) print k,A[k]}' logfile

so if I want to look inside all files in the current directory I would just use a * wildcard instead of 'logfile' right?

That is correct.

1 Like