From CAC Wiki
Jump to: navigation, search

This is a help file with trouble-shooting advice for commonly encountered issues. Please let us know if you would like us to add something.

Text file format wrong after file transfer between Windows and Unix

If you are creating or editing a text file on a Windows system and then transfer it to a Unix system, the file is often littered with ```control characters such as ^M. Conversely, text files that were created or edited on a Unix machine and then transferred to Windows appear as an endless line with no breaks.

These issues stem from the different text formats that the two systems are using. To convert the format you can use utilities called dos2unix and unix2dos:

  • On a Unix system: to convert a file that comes from a Windows system into the proper Unix text format, use dos2unix
dos2unix input output
will convert the file input (dos, Windows) into the (Unix) file output. If both filenames are identical, it will convert the file in-place from one format to the other.
  • On a Windows system: a similar utility that can be run from a command prompt window in Windows is called unix2dos and can be downloaded here (very small, just 110K).