I have a file that contains records with tab separated format but in two lines, I want to arrange records in one line with tab separated values using vim editor pattern match.
Ex.
Abc PQR XYZ NMW
XYX PQR LMW
PLX PXQ LPN PWF
XYQ PLP PMQ LWP
I want to add each second line of the record to the first line of records. The output format that I want is like this.
Abc PQR XYZ NMW XYX PQR LMW
PLX PXQ LPN PWF XYQ PLP PMQ LWP
I tried the following command to solve my problem.
:%s/\n(\w\+.*)/\t\1/cgi
This is replacing each line data with tab at front except first line.
How can we solve this using vim pattern match and replace?