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

Re: Removing Duplicate Lines from a File

by amphiplex (Monk)
on Jul 17, 2002 at 15:44 UTC ( [id://182469]=note: print w/replies, xml ) Need Help??


in reply to Removing Duplicate Lines from a File

Hi !

The uniq command expects sorted input, so you should do sort file | uniq, or, better: sort -u file

as to how to use DamnDirtyApes answer in your script:
while (<>) { unless ($n{$_}++) { ... do something whith the line ... } }

---- amphiplex

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-20 05:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found