Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: finding and deleting repeated lines in a file

by marvell (Pilgrim)
on Jun 19, 2002 at 14:50 UTC ( [id://175706]=note: print w/replies, xml ) Need Help??


in reply to Re: finding and deleting repeated lines in a file
in thread finding and deleting repeated lines in a file

Which could be condensed to:

perl -ne 'print unless $seen{$_}++' in.txt > out.txt

and if you fancy replacing it directly, whilst makign a backup file:

perl -i.bak -ne 'print unless $seen{$_}++' in.txt

--
Steve Marvell

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-29 14:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found