Chewbby

How to convert MS Newlines into ASCII ones

 

For some obscure (and probably historical) reasons, when a file is saved as text with editors such as MSWord or MSExcel and possibly others, it can produce newlines that appear strange under linux/unix. For example, if myfile.txt is such a file, typing

more myfile.txt

does not display lines properly.

 

This is because newlines are saved in a strange format. After some waste of time, I realized that this can be fixed by using the tr command, such as:

 

tr "\015" "\n" < myfile.txt > mynewfile.txt

 

Then mynewfile.txt contains proper newlines.

Hope this helps others.