Convert Newlines from Windows to Unix

Posted On Wed, 24 Oct 2012

Filed under Batch
Tags: , , , ,

Comments Dropped leave a response

16-Apr-2013: Updated source code. Rewrite of post.

Everybody knows the old trick of converting a text file with Unix newlines (LF) to Windows line-endings (CR+LF):

more unix.txt > win.txt

(Note that more will wait for a keypress after scrolling 65,534 lines, even if output is redirected to a pipe or file.) But converting from Windows to Unix is a far more complicated affair. After searching failed to find any straightforward Batch solutions—apart from this meandering thread on DosTips—I cranked out win2unix.cmd as outlined below.

continue reading »

Advertisements