how to convert line endings in text file

We often encounter the difference of the line endings among several operating systems. I guess that this is not a common tool all over the world. Using nkf command, you can easily convert line endings like the below:

  • -Lu :change to LF
  • -Lw:change to CRLF
  • -Lm:change to CR

i.e) To convert to unix-style from windows-style, run like the below.

$ nkf - Lu crlf-file.csv  > unix-lf-file.csv