0

I'm trying to return a sorted list of requests per OS type, parsed from an Apache access_log file (not combined format as I need the user-agent info). Here's an example of the output I'm looking for:

250 Windows NT 6.1; WOW64
200 X11; Linux x86_64

I've been able to find a partial solution, thanks to this post. Here's what I've got so far:

awk -F'"' '/GET/ {print $6}' access_log.3 | cut -d' ' -f2 | sort | uniq -c | sort -rn

Is it possible to use cut to get the strings I need, or is another method needed?

1
  • Can we see some sample input?
    – fedorqui
    Jan 20, 2014 at 10:38

1 Answer 1

1
awk -F'"' '/GET/ {print $6}' access_log.3 | awk -F "[()]" '{print $2}' | sort | uniq -c | sort -rn
1
  • Excellent. This works perfectly. Knew I should have been using another awk there after the first pipe. Thanks @theofpa
    – Alex
    Jan 20, 2014 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .