removing ^M from a csv file

前端 未结 3 1848
我寻月下人不归
我寻月下人不归 2021-01-05 02:06

I have a problem when I try to remove ^M from a csv

When I type vim or vi file.csv, I get

A, TK,2015-04-06,14.4^M,14.7,10.0,0.0,54.0^M,13.3^M,135.0^M         


        
3条回答
  •  借酒劲吻你
    2021-01-05 02:32

    You could use dos2unix command which is provided to do that.

    Using GNU/sed just for fun :

    sed -i -e "s/\r//g" file
    

    Using tr :

    tr -d '\r' file2
    

提交回复
热议问题