dos2unix for poor basic unix

Do you have cygwin base install right? So no dos2unix…you can convert a windows file to unix format with a small tr command like

[bash]
awk ‘{ sub("\r$", ""); print }’ winfile.txt > unixfile.txt
awk ‘sub("$", "\r")’ unixfile.txt > winfile.txt
[/bash]

See also the bash secret power addendum.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.