从CSV中删除\r(CR) [英] Remove \r (CR) from CSV

查看:152
本文介绍了从CSV中删除\r(CR)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在OSX我需要删除行结束CR( \r )字符(表示为 ^ M cat -v 的输出中):

  $ cat -v myitems.csv 

输出:

  strPicture,strEmail ^ M 
image1xl.jpg,me @ example.com ^ M



我尝试过很多sed和perl的选项,但没有任何效果。



   > dos2unix myitems.csv myitems.csv 


On OSX I need to remove line-ending CR (\r) characters (represented as ^M in the output from cat -v) from my CSV file:

$ cat -v myitems.csv

output:

strPicture,strEmail^M
image1xl.jpg,me@example.com^M

I have tried lots of options with sed and perl but nothing works.

Any ideas?

解决方案

try this, it will fix your issue.

dos2unix myitems.csv myitems.csv

这篇关于从CSV中删除\r(CR)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆