Search code examples
sedrefactoringcygwin

Refactor java classes on windows file system using cygwin


I'm trying to refactor classes from my local working copy due to an urgent refactor needed after a bug fix. So what i am doing is, using cygwin, move to the dir where my exlipse workspace is located and run this query

 find . -name "*.java" -exec sed -i 's/bug/big fix/' {} \;

I simply need to replace 1 line of code, The issue is, that this affects also classes that does not contain tat bug, i see that by looking at the java files in svn, right after running my command on the java files icons in eclipse it appears the brows asterisk appears, and if i run a diff, i see that all lines differs, even though i thought not even one line should be modified. My local working copy is on a windows file system, any advise?


Solution

  • @Aurand is probably right, it sounds like a line-ending issue. Reset the repo, then add the -b option to sed to preserve line endings.