Replace controlM character or a carriage return character and append the next line to previous line

后端 未结 1 499
情书的邮戳
情书的邮戳 2021-01-29 08:02

I am having a file like

\"A\",\"b\",\"HI This is Bad\",\"End of line1\" -- This line1 is good
\"A\",\"C\",\"THIS is^M      ------THis line2 is bad.
Good\",\"End of li         


        
1条回答
  •  隐瞒了意图╮
    2021-01-29 08:41

    sed '/\r$/{:a;N;$!ba;s/\r\n/ /g}' filename.csv>filename_final.csv

    seems to have worked.

    Basically created a label and looped it

    0 讨论(0)
提交回复
热议问题