The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 -->
  #3 (permalink)  
Old 05-28-2009
ghostdog74 ghostdog74 is offline Forum Advisor  
Registered User
  
 

Join Date: Sep 2006
Posts: 2,539
you should put in some effort next time by showing what you have done

If you have Python
Code:
#!/usr/bin/env python
d={}
for line in open("file"):
    line=line.strip().split()
    d.setdefault(line[-1],[])
    d[line[-1]].append(line[0])
for i,j in d.iteritems():
    print i, '\t'.join(j)
output
Code:
YYYYYYYYY       a6      a62
ZZZZZ   a30     a13     a43     a23
XXXXXXX         a1      a2      a71