The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #6 (permalink)  
Old 05-28-2009
durden_tyler's Avatar
durden_tyler durden_tyler is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2009
Posts: 547
Quote:
Originally Posted by repinementer View Post
... I tried to write script in perl but the sript was giving funny values and wasted 3 hrs. I didn't want to put the scipt coz that sript doesn't make any sense.
...
Ah, the glorious messiness of Perl:


Code:
$
$ perl -ne 'split; $x{$_[1]}=$x{$_[1]}."\t".$_[0]; END{foreach $k(keys %x){print $k,"\t",$x{$k},"\n"}}' input.txt
XXXXXXX         a1      a2      a71
ZZZZZ           a30     a13     a43     a23
YYYYYYYYY               a6      a62
$
$

As Larry Wall says - "Easy things should be easy, and hard things should be possible."
Amazon.com Message

Cheers,
tyler_durden
Bits Awarded / Charged to durden_tyler for this Post
Date User Comment Amount
05-28-2009 vidyadhar85 Great quote!! 1,000