dpbevin
March 18th, 2009, 12:35 AM
I'm trying to convert the line endings in files that end in ',v' from *nix (\n) to windows style (\r\n).
Some of the files contain spaces or '~' and it's causing me problems.
Here's the original command I started with.
find . -type f -name '*,v' -or -name '.*,v' -print -exec perl -p -i -e 's/\n/\r\n/' {} \;
I know I should be using -print0 with find and "xargs -0" instead of -exec but I can't get it to work.
I think I'm having problems because the search/replace term in the perl script contains newlines.
Any ideas?
Thanks in advance.
David
Some of the files contain spaces or '~' and it's causing me problems.
Here's the original command I started with.
find . -type f -name '*,v' -or -name '.*,v' -print -exec perl -p -i -e 's/\n/\r\n/' {} \;
I know I should be using -print0 with find and "xargs -0" instead of -exec but I can't get it to work.
I think I'm having problems because the search/replace term in the perl script contains newlines.
Any ideas?
Thanks in advance.
David