title: Count number of records and remove new line character in between a record in csv file(size almost 132 GB) using shell/awk/perl
body: <p>I'm unable to count the number of records and remove new line characters which is present in between a single record and append this file output to another code. Csv file looks like</p>
  
  <pre><code>RandomName,FileName,Date,OwnerName
  "f","df",10/12/1298,"dgds"
  -13,"fg
  dhd
  fd
  f",10/22/1029,"dvg 
  tr
  -456
  3gf"
  "123","fd13",13/23/1245,"13
  sdg
  fsdg"
  dv,"Df",12/12/3455,"adf"
  </code></pre>
  
  <p>Expected Output</p>
  
  <pre><code>RandomName,FileName,Date,OwnerName
  "f","df",10/12/1298,"dgds"
  -13,"fgdhdfdf",10/22/1029,"dvgtr-4563gf"
  "123","fd13",13/23/1245,"13sdgfsdg"
  dv,"Df",12/12/3455,"adf"
  </code></pre>
  
  <p>The file is 132GB  in size.I'm using this solution-</p>
  
  <pre><code>perl -0777 -pe 's/((?:,"|(?!^)\G)[^",\n]*)\n/\1/g; s/,\n/,/' "${dir}" | wc -l
  </code></pre>
  
  <p>But Its throwing kernel soft lockup error. I have shell/awk/perl in my server.
  My File can contain-</p>
  
  <ol>
  <li>any number of records </li>
  <li>size &lt;= 132 GB</li>
  <li>file can contains special characters.($,@,#,*,-,_,%)</li>
  <li>new line character can occur more than once in a single record.</li>
  </ol>
  
  <p>Kindly help me in finding solution for printing the output to console and to another csv file as well.
  Thanks in advance.</p>