removing ^M from a csv file

前端 未结 3 1864
我寻月下人不归
我寻月下人不归 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:20

    Where did you get that file from? It looks like an old System X file from a Mac. The old pre-OSX OS used as line endings. Unix uses , and Windows/DOS uses .

    Do you have dos2unix. This program can convert line endings from Unix/Linux, DOS/Windows, or System X Macs to any of the formats you want. In your file, I take it you need to convert the ^M which are Control Ms and not a Caret-M to NL characters.

提交回复
热议问题