CSV processing: moving column/row value to different row where column value matches
0
votes
2
answers
239
views
I have a csv file with around 50 columns, can be anywhere between 20 and 100 rows.
The individual records have IDs, and some records can be in a group of 2. Essentially what I need to do is add an ID to the same row that another ID in that group is in. Example:
ID ,group,blank column
2019-1 , ,
2019-2 ,GRP1 ,
2019-3 ,GRP2 ,
2019-4 ,GRP1 ,
2019-5 , ,
2019-6 ,GRP2 ,
And the output I would like is:
ID ,group,blank column
2019-1 , ,
2019-2 ,GRP1 ,2019-4
2019-3 ,GRP2 ,2019-6
2019-5 , ,
In my attempts using awk, I haven't had any luck. I either end up leaving out rows that have no group, or I end up repeating values.
Asked by Cody Thomas
(9 rep)
Feb 11, 2019, 06:52 PM
Last activity: Mar 10, 2025, 10:53 PM
Last activity: Mar 10, 2025, 10:53 PM