This is a Source File
Field1~^Field2~^Field3
Value1~^Value2~^Value3
Value4~^Value5
Value6~^Value7~^Value8
Value9
Value10~^Value11
I want to Append Data and Check how it will Give Output
awk -F '[ ~ ] [\\^] ' ' {While (NF<3) {getline p; $0 =$0 '' '' p};print}' < abc_File.txt > tgt_abc_File.txt
I tried this Command Please Tell me what's wrong in this Command because it will Create Blank Target File
@Vivek_Patil
Please use markdown code tags as required by the forum rules.
I've edited your post for now, but do follow the rules going forward.
As for the "Command" and what's wrong with it... I can see many things wrong with it. Have you tried running it yourself?
When I tried it, I get the following:
$ awk -F '[ ~ ] [\\^] ' ' {While (NF<3) {getline p; $0 =$0 '' '' p};print}' < vivek.txt
awk: cmd. line:1: {While (NF<3) {getline p; $0 =$0 p};print}
awk: cmd. line:1: ^ syntax error
Also, what would be the desired output based on your input?
A more representative data input would be helpful as well...
We can only guess what you're after...
2 Likes