so i am running a bash script on an apache log file i can sort the IP addresses and show the most common on but it shows it at the bottom of the page no the top how do i show it from highest to lowest
this is my script so far
cat access_log.txt | awk '{print $1}'| uniq -c |sort -n -k 1| tail
in my txt file i have
10.23.234.0
250.40.56.78
8.45.98.250
10.23.234.0
250.40.56.78
8.45.98.250
10.23.234.0
250.40.56.78
10.23.234.0
250.40.56.78
10.23.234.0
10.23.234.0
the output is
2 8.45.98.250
4 250.40.56.78
6 10.23.234.0
i want the output to be
6 10.23.234.0
4 250.40.56.78
2 8.45.98.250
also want would be the best way to print out the DNS name next to it so example
66.249.73.234 - - [12/Fegb/2013:12:00:09 +1100] "GET /java/tut/tut.sgml-065.html HTTP/1.1" 200 752 "-" "Mozilla/6.0 (compatible; Googlebot/2.1; +http://www.google.com.html)"
so it would be
66.249.73.234 - http://www.google.com.html
Thanks