Converting DOS filetype to UNIX

view full story

http://www.unix.com – Hello folks I am working on a project that requires me to write a script that operates on a bunch of text files. When I try Code: less file.txt I see a bunch of ^M's everywhere. Some Googling tells me that this is because the files have a DOS fileformat and found the following fixes: Code: sed 's/^M$//' file.txt > output.txt or Code: dos2unix file.txt Alas, neither of these approaches seems to work. When I open the file in gedit, everything is formatted appropriately and if I use gedit to save the file as file1.txt, the new file is fine when I do Code: less file1.tx (HowTos)