View Single Post

  #1 (permalink)  
Old 12-05-2006, 10:51 AM
sureshbup sureshbup is offline
Junior Member
User
 
Join Date: Dec 2006
Posts: 5
Rep Power: 0
sureshbup
Default rearranging columns in a text file

Hi to all.

I am new to linux.

I am using redhat linux.

data is like this in a text file

First column second column

Ramesh , aiubghed
Ramesh , ghed
Ramesh , aiubaiub
Suresh , aghedghed
Suresh , aigheded
Suresh , aiughedhed
Kathir , aiddtghed
Kathir , ghteteed
Kathir , aiuopiiub
john , agheddlked
john , aigpqwsed
john , aidffedhed


first column having names and second column having its corresponding data..


i need a output like this


First column-Second column - Third column
Ramesh - Suresh - Kathir
aiubghed - aghedghed - aiddtghed
ghed - aigheded - ghteteed
aiubaiub - aiughedhed - aiuopiiub

and so on...

In first column uniq field should come as a heading and corresponding second column as a column.

like this i have to do for 5000 names and it corresponding values...

Is it possible to do it in awk or sed. I am new to linux. please some help ..


Thanks in advance..

with kind regards
ramesh
Reply With Quote