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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting multiple instances of same word

Status
Not open for further replies.

6839470

Programmer
Mar 7, 2004
45
0
0
US
Hello all,

I have a file with multiple instances of same word. Though all words start with same 3 letters dsp.

dspusers
dspusers
dspusers
dspftp
dspftp

how can I get rid of same words repeating, keeping the first instance intact..

HELP please



 
man sort
man uniq

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
OOps, we are in the awk forum, not unix scripting ...
awk '/^dsp/{a[$1]}END{for(i in a)print i}' /path/to/input

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Ah, old fashioned awk still alive ...
And this ?
awk '/^dsp/{++a[$1]}END{for(i in a)print i}' /path/to/input

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Sorry to bother you...But can you see the post which says HELP. I have the exact problem listed there. Please let me know if you have a solution for this too.


thanks alot
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top