Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Remove duplicate data from text file

by mirod (Canon)
on Nov 28, 2001 at 00:24 UTC ( #127897=note: print w/replies, xml ) Need Help??


in reply to Remove duplicate data from text file

If you are on unix and don't care about the order of the output (or want it sorted): sort -u <file> is your friend.

Otherwise you can try:

perl -n -e 'print unless $seen{$_}++;' <file>

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://127897]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2022-08-09 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?