Chapter 12
- Field 1
- You can use
print NR
or alternatively pipe the output towc -l
We must use -l
otherwise, it will count words instead.
$ awk '{print $1}' access.log | sort | uniq -c
$ awk '{print $7}' access.log | grep 'php' | sort | uniq -c | sort -nr | head -n 1
You should use head -n 1
to get the one page only.