'Am I using grep properly?
I am new here and need help with a problem I can't seem to solve. I am working on my class project and analyzing a log file, so far I have been successful up to this point:
Which IP address was accessing robots.txt files the most times? grep has been useful except here I am unable to get the list of ip addresses with:
grep "robots.txt" CIS294CP.txt | sort
This gives me the full list but I need to narrow this down to the ip address that accessed the file the most times. When I first opened the log file and searched ip addresses using:
grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" CIS294CP.txt | sort | uniq -c | sort -n | tail
I was successful getting the ip addresses, number of times they accessed the server and sorted them in order with the highest numbers at the tail end. I am not finding the same success for the robots.txt files.
grep -c "robots.txt" CIS294CP.txt | sort -rn
gives me the total number of ip addresses that accessed the file (180)
grep "robots.txt" CIS294CP.txt | sort
listed ALL 180 ip addresses I've tried other commands but am not successful
I am looking for the proper command to show the number of times the ip accesses the file and sort them from lowest to highest
I'm hoping my question makes sense and thank you for your help and patience.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|