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!

Extracting unique IDs from a file 2

Status
Not open for further replies.

630111

MIS
Oct 30, 2001
127
US
I have a text file with the following:

Andy
Bill
Brian
Jessica
Michelle
Judy
Julie
Larry
Luke
Bill
Brian

I want to extract only one occurance of each name, no matter how many times it appears in the file. How would I go about this?

Thanks!
630111
 
sort -u myFile.txt

vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Try something like this:
sort -u /path/to/inputfile
If you want to keep original order:
awk '++a[$0]==1' /path/to/inputfile

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

Part and Inventory Search

Sponsor

Back
Top