Hi,
I have data with broken lines:
Sample data:
"12"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:10:50"
"16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"
2453748"|"08:15:50"
"16"|"25"|"a"|"b"|"
c"|"d"|"e"|"f"|"2453748"|"08:19:50"
"16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:19:50"
In the above data, 2nd & 3rd row's are split to two lines, and my goal is to achieve the below data
"12"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:10:50"
"16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:15:50"
"16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:19:50"
"16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:19:50"
I have tried this code
awk 'BEGIN {
FS=OFS="|"
FLDmax="10"
}
{
if (NF < FLDmax ){
print $0; getline ;ORS=""; print $0;ORS="\n"
}
else
{
print $0}
}' inputfile >outputfile
and the output is
"12"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:10:50"
"16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"
2453748"|"08:15:50""16"|"25"|"a"|"b"|"
c"|"d"|"e"|"f"|"2453748"|"08:19:50""16"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:19:50"
"12"|"25"|"a"|"b"|"c"|"d"|"e"|"f"|"2453748"|"08:10:50"
"12"|"25"|"a"|"
b"|"c"|"d"|"e"|"f"|"2453748"|"08:10:50""17"|