HowTo: Convert Between Unix and Windows text files

HowTo: Convert Between Unix and Windows text files

To convert a text file from Unix format to Windows format, or vice versa, you can use the dos2unix and unix2dos utilities. These utilities are typically included in most Linux distributions, and can be installed on Windows using tools such as Cygwin or Git for Windows.

To convert a Unix-formatted text file to Windows format, use the unix2dos command:

refer ‮ot‬:lautturi.com
unix2dos input_file.txt output_file.txt

This will convert the input_file.txt file from Unix format to Windows format, and save the result to output_file.txt.

To convert a Windows-formatted text file to Unix format, use the dos2unix command:

dos2unix input_file.txt output_file.txt

This will convert the input_file.txt file from Windows format to Unix format, and save the result to output_file.txt.

You can also use the -n option to convert the file in-place, without creating a new output file:

unix2dos -n input_file.txt
dos2unix -n input_file.txt

Keep in mind that these utilities will only convert the line endings in the text file.

Created Time:2017-10-16 14:38:51  Author:lautturi