Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Issue in Concatenation/Joining of lines in a dynamically generated file

$
0
0
Hi,

I have a file containing many records delimited by pipe (|).
Each record should contain 17 columnns/fields. there are some fields having fields less than 17.So i am extracting those records to a file using the below command
Code:

awk 'BEGIN {FS="|"} NF !=17 {print}' feedfile.txt >feedfilebadrecs.txt
Then i am concatenating all lines in feedfilebadrecs.txt to one single line.

Code:

tr -d '\n' < feedfilebadrecs.txt
but its not working. The concatenation is not happening.I have tried concatenating with other commands like paste,sed , awk etc. but not working(giving some random line as output from the input file)

I applied these commands for concatenating on some other manually created files and its working .

I am not able to understand why concatenation is not happening on dynamically created file using awk.

Please help me to figure this out..

Thank You

Viewing all articles
Browse latest Browse all 16232

Latest Images

Trending Articles



Latest Images