remove ^M characters from file using sed

前端 未结 9 2369
情书的邮戳
情书的邮戳 2020-12-01 15:35

I have this line inside a file:

ULNET-PA,client_sgcib,broker_keplersecurities
,KEPLER

I try to get rid of that ^M (carriage return) charact

9条回答
  •  不思量自难忘°
    2020-12-01 16:10

    Use tr:

    tr -d '^M' < inputfile
    

    (Note that the ^M character can be input using Ctrl+VCtrl+M)


    EDIT: As suggested by Glenn Jackman, if you're using bash, you could also say:

    tr -d $'\r' < inputfile
    

提交回复
热议问题