Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Comparing lines of multiple files

by Zed_Lopez (Chaplain)
on Oct 09, 2005 at 19:26 UTC ( [id://498620]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my %h;
    
    ...
      $cmp{$_} = '' for values %{$h{$id}};
      print keys %cmp if scalar keys %cmp == 1;
    }
    
  2. or download this
    while (<>) {
      my @fields = split ',';
    ...
    for my $id (sort keys %h) {
        print keys %{$h{$id}} if scalar keys %{$h{$id}} == 1;
    }
    
  3. or download this
    scalar keys %{$h{$_}} == 1 and print keys %{$h{$_}} for sort keys %h;
    
  4. or download this
    perl -ane '$h{$F[0]}{$_}=0;END{keys%{$h{$_}}==1&&print keys%{$h{$_}}fo
    +r sort keys%h}' f1.txt f2.txt
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-25 23:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found