Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting unique strings

Status
Not open for further replies.

chomps303

MIS
Sep 30, 2003
83
US
I have a file with multiple fields that have the same info.
How can I get a count of UNIQUE strings.

Thanks

ttyp7
ttyp2
ttyp0
ttyp0 < Only count this 1 time
ttyp1 < Only count this 1 time
ttyp1
ttyp1
ttyp23
ttyp20
ttyp23 < Only count this 1 time
ttyp23
ttyp20
ttyp29 < Only count this 1 time
ttyp29
ttyp44 < Only count this 1 time
ttyp44
ttyp45
ttyp55 < Only count this 1 time
ttyp55
ttyp66
 
Hi.
Code:
uniq <yourfilename> |wc -l
counts unique strings (at least on AIX).

Stefan
 
Thanks a million!!

SCO v5.07 also has uniq! Never knew that

Brandt
 
uniq is for sorted file.
You may try sort -u

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top