Top IP Addresses – Linux shell interview question

A log file is of the following format

sessionid	ipaddress
1234		127.0.0.1
4567		127.0.0.1

Find the list of top 10 IP Addresses that have the most log entries.

2 Comments

  1. techie007 says:


    cat LOG_FILE | awk '{ print $2}'| sort | uniq -c | sort -r +0 -1 | head -10 | awk '{print $2" ->" $1}'

  2. JUSTIN says:


    CheapTabletsOnline.com. Canadian Health&Care.No prescription online pharmacy.Special Internet Prices.Best quality drugs. Low price pills. Order pills online

    Buy:Levitra.Cialis Professional.Soma.Viagra Soft Tabs.Propecia.Cialis.Viagra Super Active+.Maxaman.Zithromax.Viagra.Cialis Super Active+.Tramadol.Viagra Super Force.VPXL.Super Active ED Pack.Viagra Professional.Cialis Soft Tabs….

Leave a Reply