syntax error The source line is 1.
The error context is
/BILL_NO/{printf $3}/NAME\>/{print >>> NF== <<<
awk: The statement cannot be correctly parsed.
The source line is 1.
Yes this worked except the last two rows. The output is now as below
1234,ABC
5678,BCA
1256,NA
3458934,PKL
The last two rows are coming together. The outpur should be as below:
1234,ABC
5678,BCA
1256,NA
345,NA
8934,PKL
As I mentioned before, the ending tag for the second last row is different from the previous tag where name is balnk. The tag is <NAME/> where as for the previous one is <NAME></NAME>. If I change <NAME/> to "<NAME></NAME>", it works fine. But it is not confirmed that the tag will always be complete xml tag. I might receive the xml ending tag (<NAME/>)only. I was also qurious to know what will happen, if no tag is sent.
Thanks for your support and help. It is now working perfectly irrespective of the tag format. Will it work in case the tag is not passed at all ? What is the purpose of ^I ?
If it takes care of non existense of the tag, it did not give desired output.
I tried by removing NAME tag for one of the bill number and the putput is as below: