X
1
2
3
.
.
Unknown number of rows
Y
X
1
2
.
.
Unknown number of rows
Y
where the number of rows between each matching X and Y strings are not same.
I need the following output
1 2 3
1 2
I got a awk based script( from this forums) but it is not working since the number of rows between keywords( X and Y ) are not same.
awk -v col=3 '{if(NR%col){printf "%s ",$0 }else {printf "%s\n",$0}} '
Link: How to convert a single column into several columns?
Thanks in advance..
Thanks pamu for your quick reply.
The code you mentioned is doing it's job put it is putting two 'Y' characters at the end of each row.
Can we get rid of that ?
Also on the actual data I have I am getting some formatting issue, I will try to work on that myself anyway.