Hello All,
I have had a thorough search around for a solution to problem but am yet to find one. I have found part solutions and getting close but can't seem to close the deal.
My raw data looks something like, where ValueX is a comma seperated values.
1,ValueX
6,ValueY
8,ValueZ
etc
I need to fill this data out to get something like
1,Value X
2,Value X
3,Value X
4,Value X
5,Value X
6,Value Y
7,Value Y
8,Value Z
9,Value Z
I have managed to get:
1,Value X
2,
3,
4,
5,
6,Value Y
7,
8,Value Z
9,
using
At this stage I am completely lost and don't know how to refer back toa previous line (NR maybe?)'
Any assistance you could offer would be greatly appreciated
Thanking you in advance
Benjamin
I have had a thorough search around for a solution to problem but am yet to find one. I have found part solutions and getting close but can't seem to close the deal.
My raw data looks something like, where ValueX is a comma seperated values.
1,ValueX
6,ValueY
8,ValueZ
etc
I need to fill this data out to get something like
1,Value X
2,Value X
3,Value X
4,Value X
5,Value X
6,Value Y
7,Value Y
8,Value Z
9,Value Z
I have managed to get:
1,Value X
2,
3,
4,
5,
6,Value Y
7,
8,Value Z
9,
using
Code:
awk ' BEGIN { FS = OFS = ","};{a[$1]=$0}; END{for(i=1; i <= 10; ++i) {print((i in a)?a[i]:i)}}'
At this stage I am completely lost and don't know how to refer back toa previous line (NR maybe?)'
Any assistance you could offer would be greatly appreciated
Thanking you in advance
Benjamin