How to escape ^M from svn:eol-style native

可紊 提交于 2019-12-25 04:07:37

问题


We have specified eol-style:native property in our subversion repository for shell script; this gets rid of ^M characters which are included when file is edited on Windows and executed on UNIX box.

But recently we ran into an issue:

One shell script had following statement written:

sed 's/^M//g' source_file > target_file

to replace ^M characters from a data file. But when the script is checked-in in subversion and updated on unix box the statement becomes:

sed 's/
//g' source_file > target_file

REAL QUESTION

I need a way to put ^M character in shell script in subversion with eol-style:native property already present. I don't want this specific ^M character to be lost in transition. Is it possible?


回答1:


use \r instead of ^M

sed 's/\r//g' source_file > target_file


来源:https://stackoverflow.com/questions/12209243/how-to-escape-m-from-svneol-style-native

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!