Line Endings

From Exterior Memory
Jump to: navigation, search


The following line endings exist (according to section 5.8 of Unicode 5.0):

Code point Name
10 (0x0A) Line Feed (LF)
11 (0x0B) Line Tabulation (VT)
12 (0x0C) Form Feed (FF)
13 (0x0D) Carriage Return (CR), except when followed by LF
133 (0x85) Newline (NEL)
8232 (U+2028) Line seperator (like <br/> in HTML)
8233 (U+2029) Paragraph seperator (like <p> in HTML)

The following file systems uses these line endings:

Characters Operating System
LF (0x0A) Unix and Mac OS X
CR LF (0x0A 0x0D) MS-DOS and Windows
CR (0x0D) Mac OS (up to Mac OS 9)


The most useful utilities are flip and textconv:

Convert line endings to line feed (UNIX):

flip -u *.txt
textconv -u *.txt

Flip can also display line endings:

flip -t *.txt

Other utilities include dos2unix, tofrodos, using tr, etc. But these require you to know in advance what the current line ending is.