Hi All,
Need to modify a file basically join the extra line to one I am having a file like below
And would like to make it as below .
Hi All,
Need to modify a file basically join the extra line to one I am having a file like below
And would like to make it as below .
First try, just looking for lines ending in comma to join together:
$ awk '/,$/ { S=$0 ; getline ; $0=S $0 } 1' inputfile
A10
Records of transfer
File received
X,X,X,X,1,1,1,0,A.10,B.10,C.10,D.10,E.10,F.10
X,X,X,X,1,1,1,0,A.11,B.11,C.11,D.11,E.11,F.11
X,X,X,X,1,1,1,0,A.12,B.13,C.14,D.14,E.14,F.14
$
Sorry missed header records. It is also having commas there too. So going by , wont work I think. Will the below awk work if find the starting X and transfer the line
$ awk '/^X/ { S=$0 ; getline ; $0=S $0 } 1' inputfile
A10
Records of transfer
File received
P195,P195,P15,
C195,C195,C15,
X,X,X,X,1,1,1,0,A.10,B.10,C.10,D.10,E.10,
F.10
X,X,X,X,1,1,1,0,A.11,B.11,C.11,D.11,E.11,
F.11
X,X,X,X,1,1,1,0,A.12,B.13,C.14,D.14,E.14,
F.14
It does for me, does it for you?
Yes it worked... Thanks a lot