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

Re: Sorting By Column

by oiskuu (Friar)
on Jul 10, 2014 at 22:04 UTC ( #1093138=note: print w/ replies, xml ) Need Help??


in reply to Sorting By Column

If file identity in column 1 were omitted, you could use the unix comm utility to eliminate duplicates.

See if this works to your satisfaction (give input files as arguments):

#! /usr/bin/perl my %X; for (<>) { my ($i,$k,$n) = split(" ",$_,3); $X{$k.$n}{$k.$i} = $_; } for (sort {$a->[0] cmp $b->[0]} map [%$_], values %X) { print $_->[1] if @$_ == 2; }


Comment on Re: Sorting By Column
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (10)
As of 2014-12-21 17:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (106 votes), past polls