"extra" carriage return/line feed information on files edited in Windows

Technote (FAQ)


Question

Why do I see "extra" carriage return/line feed information on files edited in Windows when they are viewed in UNIX?

Answer

Lines in text files that have been created or updated under DOS or Windows end with:

\r \n

Whereas lines in text files created or updated under UNIX end with only:

\n

\r = return (CR) octal 015
\n = new-line (NL) octal 012

If you want a file created under DOS or Windows to look good under UNIX, you can run the following command. Note: This will delete *all* the CRs from the file.

tr -d "\r" < input_dos_or_win_file > output_unix_file

Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

AFS
AFS

Software version:

3.5, 3.6

Operating system(s):

Windows 2000, Windows NT

Software edition:

All Editions

Reference #:

1044658

Modified date:

2011-11-06

Translate my page

Machine Translation

Content navigation