Cross platform developers often encounters some problem with file-formats at some point.This article may give them some clue regarding how to procede.
Unix/dos file formats is determined by the type of end-of-line (EOL)
markers used in text files. Unfortunately,different operating system use different tokens to represent the end of a line of text in a file. For example, the usual line ending token used by software on the Windows platform is a pair of ASCII control characters—carriage return
(CR) and line feed (LF). Unix software, however, just uses the LF character to denote the end of a
line.
Not all of the various tools on these operating systems are prepared to understand files that contain line endings in a format that differs from the native line ending style of the operating system on which they are running. Common results are that Unix programs treat the CR character present in Windows files as a regular character (usually rendered as ^M), and that Windows programs combine all of the lines of a Unix file into one giant line because
no carriage return-linefeed (or CRLF) character combination was found to denote the end of
line.
To convert from dos file system to unix ,use dos2unix utility .For reverse conversion use unix2dos
For recursive conversions use the following one liner in most linux platforms
find . -type f \! -exec dos2unix {} \;
execute this from the top level directory. This will do it recursively in all sub folders.
No comments:
Post a Comment