Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Filtering lines from one file from another

by mertserger (Curate)
on Feb 03, 2011 at 09:16 UTC ( [id://885930]=note: print w/replies, xml ) Need Help??


in reply to Filtering lines from one file from another

Another non-Perl solution would be the Unix command "comm"
comm -23 file1 file2 would do it.
I like comm because you can get lines in file1 and not in 2, in 2 and not in 1 and lines common to both.

Replies are listed 'Best First'.
Re^2: Filtering lines from one file from another
by Limbic~Region (Chancellor) on Feb 03, 2011 at 16:16 UTC
    mertserger,
    The problem with comm is that it requires the files to be sorted (which they are not). If antonn doesn't need to preserve order than this is a fine solution. It is actually a fairly difficult problem to solve if you self-impose a number of constraints such as order preservation and arbitrarily large files.

    Cheers - L~R

Log In?
Username:
Password:

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

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

    No recent polls found