Awk Join multiple lines

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"|

Try this awk program :

awk '
        BEGIN {
           FS="|";
           FLDmax=10;
        }
        {
           while (NF < FLDmax || $0 ~ /\|\"$/) {
              getline record;
              $0 = $0 record
           }
           print $0
        }
    ' inputfile

Jean-Pierre.

sed -e :a -e '/|$/N; s/\\\n//; ta'  oldfile > newfile

Jean-Pierre Thanks again for your solution. it worked like a charm again. let me try to explain you the code you have posted, please correc me if i am wrong.

while (NF < FLDmax || $0 ~ /\|\"$/) {
              getline record;
              $0 = $0 record
           }

pick up all the records that for which the no of fields are less than 10 or if the line has is ending with |" and with a getline and $0 you are merging before printing it... am i right?

While the current record ($0) is less than 10 fields (NF) or is imcomplete (endig with |"), update the current record by appending the next record.

Jean-Pierre.

Thanks - Cheers!!!