remove ^M characters from file using sed

前端 未结 9 2389
情书的邮戳
情书的邮戳 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:21

    still the same line:

    sed -i 's/^M//g' file
    

    when you type the command, for ^M you type Ctrl+VCtrl+M

    actually if you have already opened the file in vim, you can just in vim do:

    :%s/^M//g
    

    same, ^M you type Ctrl-V Ctrl-M

提交回复
热议问题