For Programmers: Free Programming Magazines  


Home > Archive > AWK > January 2008 > concatenating 2nd field if 1st field is same









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author concatenating 2nd field if 1st field is same
sixstringsin@yahoo.co.in

2008-01-13, 6:59 pm

I have a file:

data1:1,2,3,4
data2:434,434,233,7
data3:23,44,76,334
data4:4,6,55,8
data1:6,76,45,09
data5:45,43,343,2
data2:3,43,5,5656,5


I am using awk with input field separator as ":"

I want to concatenate field 2 of every record that has the same field
1.


The final contents of the processed file should look like:

data1:1,2,3,4,6,76,45,09
data2:434,434,233,7,3,43,5,5656,5
data3:23,44,76,334
data4:4,6,55,8
data5:45,43,343,2


Any guidance is highly appreciated.
Kenny McCormack

2008-01-13, 6:59 pm

In article <c4ff98be-323d-4802-9d1e-f48a0bcb3d18@q39g2000hsf.googlegroups.com>,
<sixstringsin@yahoo.co.in> wrote:
>I have a file:

.... (repeat post)
>Any guidance is highly appreciated.


Here's some guidance: Learn to not double-post.

When ya got that under control, get back to us, mmkay?

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com