Subscribe Now!

Each operating system has different special characters to mark the end of line (EOL) or end of file (EOF) in simple text files. If transferring by FTP, the file conversion may be done automatically by your client based on the file extension or you could force it using the ascii command before the transfer; if not, you may have to employ the methods we discuss below.

Note that this does not apply to complex word processor documents or other data files, as these are almost always saved in some binary format that does not need this kind of conversion – in fact, applying this conversion to anything other than a simple text file (i.e., a binary file) will damage it and make it unusable.

Perhaps the most powerful method is by downloading and installing dos2unix and unix2dos (link below), then issuing <command> input.txt output.txt and making the appropriate substitutions.

windows

If you are on Windows and do not want to install other programs, you may try “more”.

1. A simple, straightforward method that involves the command prompt only is the use of the “more” command (run more /? to learn more about it).

TYPE input_filename | MORE /P > output_filename

This command will take quite a bit to do its magic on a large file, so be patient.

The following solutions are slightly more complicated, but may be useful in certain special situations.

2. You may also use vbscript, as follows:

Do Until WScript.StdIn.AtEndOfStream
WScript.StdOut.WriteLine WScript.StdIn.ReadLine
Loop