The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 05-15-2008
amatuer_lee_3 amatuer_lee_3 is offline
Registered User
 

Join Date: May 2008
Posts: 53
how to sort, and count unique data all at once?

Quote:
echo "Number of unique I.P.'s: "

uniq $2 HITS | wc -l
I have this code.

In the file called HITS.hits my results are displayed liked this:

filename.hits: 35.114.42.113 Mon Nov 21 08:26:41 GMT 2005

What i want my code to do is to search all of the unique IP addresses.
so count all the adresses that appear.
but just count repeat IPs that are the same as 1.

so if my file had:

filename.hits: 11.111.11.111
filename.hits: 33.333.33.333
filename.hits: 22.222.22.222
filename.hits: 44.33.222.111
filename.hits: 11.111.11.111

the answer would be 4.
Reply With Quote
Forum Sponsor