Apr 21, 2004 #1 630111 MIS Joined Oct 30, 2001 Messages 127 Location 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
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
Apr 21, 2004 1 #2 vgersh99 Programmer Joined Jul 27, 2000 Messages 2,146 Location US sort -u myFile.txt vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+ Upvote 0 Downvote
sort -u myFile.txt vlad +----------------------------+ | #include<disclaimer.h> | +----------------------------+
Apr 21, 2004 1 #3 PHV MIS Joined Nov 8, 2002 Messages 53,708 Location FR 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 Upvote 0 Downvote
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