^M character
Posted in 2006
Topics: General Discussion
Hi guys, I have got files in directory and all the files have got ^M is there any way to replace all the ^M character in all the file recursively. -- Regards, Prateek Jain
Prateek Jain wrote: > I have got files in directory and all the files have got ^M is there any > way to replace all the ^M character in all the file > recursively. Look up the dos2unix utility. It may already be on your system. Ben.
If you're on a Unix or Unix-like system, edit the file in vi and do a global replace of the carriage return with "nothing;" once the file is open enter :g/<CNTRL-V><CNTRL-M>/s///g where <CNTRL-V> is the control key, followed by V (this lets you enter the CNTRL-M). Otherwise, use sed pretty much the same way: sed 's/<CNTRL-V><CNTRL-M>//g' input_file > output_file If you're unfortunate enough to be stuck on winders, get and install VIM and use that as given above. See http://www.vim.org. Prateek Jain wrote: > Hi guys, > I have got files in directory and all the files have got ^M is there any > way to replace all the ^M character in all the file > recursively. > -- > Regards, > Prateek Jain -- Everything works -- if you let it.