Skip to main content
2 of 2
added 44 characters in body
jesse_b
  • 41.5k
  • 14
  • 108
  • 162

using sed how to append N number of lines

I have the following csv file:

hostname1,this is a test,001^M
hostname2,this is
a test,002^M
hostname3,this
is
a
test,003^M

The first line is the proper format of the line. I want the other lines to follow the same format. The problem is for the second column, some of them have carriage returns so the third column is on a new line, but I want to use sed to join all the lines regardless of how many lines they broke apart.