Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Remove duplicate data from text file

by mirod (Canon)
on Nov 28, 2001 at 00:24 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-18 02:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found