0

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?

Bharat Sinha
  • 13,973
  • 6
  • 39
  • 63
  • I'm actually surprised that Subversion affects this because this isn't a , but just a character. I would assume this to be a bug in Subversion. What if you change this file to have an `svn:eol-style` of `LF`? Would that affect your sed script? Otherwise, hope your `sed` script is GNU and it'll take a `\r`. – David W. Aug 31 '12 at 14:23
  • possible duplicate of [^M on Windows Linux via subversion](http://stackoverflow.com/questions/12209093/m-on-windows-linux-via-subversion) – Bert Huijben Sep 06 '12 at 15:47

1 Answers1

1

use \r instead of ^M

sed 's/\r//g' source_file > target_file
Jon Lin
  • 142,182
  • 29
  • 220
  • 220