Tuesday, December 27, 2011

EOL issues on Unix/Windows

in vi, if you want to view a file in HEX mode, do this:

:%!xxd


line feed=10=0x0A (\n)
carriage return=13=0x0D (\r)


in Windows, a EOL is defined by \r\n (0D0A)
in Unix, a EOL is defined by \n (0A)


to change EOL to some other character:

tr '\n' '#' < test1.txt > test2.txt

to turn a Windows file into Unix:
dos2unix filename

Excellent Notepad++ to convert one format into another (Edit/EOL conversion)

No comments: