Converting different text formats

Line endings

Sometimes you'll have to transfer plain text files from Linux to other systems like Mac or Windows. For this you'll have to deal with different combinations of CR (carriage return) and LF (line feed) for line endings:

System Line endingSorted ascending
DOS/Windows CR LF
Mac LF

You may use the commands fromdos or todos to change the line ending format different formats. This can also be done by some text editors like vi or with commands like tr, sed, or similar.

Character encoding

The command iconv allows modification of the text encoding, e.g. from ISO 8859-1 to UTF-8 with iconv -f latin1 -t utf8 file_lat1.txt > file_utf8.txt.

For more information please read the man page or take a look at this article (in German language).

-- StefanHaller - 06 May 2015

This topic: Linux > WebHome > TipsTricks > TipsTextFormats
Topic revision: 2015-05-06, StefanHaller
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding GSI Wiki? Send feedback | Imprint (german) | Privacy Policy (german)