CR = Carriage Return
LF = Line Feed
Betriebssystem | Zeichensatz | Abkürzung | Code Hex | Code Dezimal | Escape-Sequenz |
Unix, Linux, Android, Mac OS X, AmigaOS, BSD | ASCII | LF | 0A | 10 | \n |
Windows, DOS, OS/2, CP/M, TOS (Atari) | ASCII | CR LF | 0D 0A | 13 10 | \r\n |
Mac OS bis Version 9, Apple II, C64 | ASCII | CR | 0D | 13 | \r |
AIX OS & OS/390 | EBCDIC | NEL | 15 | 21 | \025 |
sed
NAME sed - stream editor for filtering and transforming text DESCRIPTION Sed is a stream editor. A stream editor is used to perform basic text transformations on an input stream.
# DOS => UNIX # replace every "\r" with "" $ sed "s/\r//" infile >outfile # UNIX => DOS # add in every line-end (RegEx $) before \n the character \r $ sed "s/$/\r/" infile >outfile
How to convert DOS/Windows newline to Unix newline in bash script?
sed Tutorium – Eine Einführung in sed
Useful one-line scripts for sed
tr
NAME tr - translate or delete characters DESCRIPTION Translate, squeeze, and/or delete characters from standard input, writing to standard output.
# delete every "\r" tr -d \r <infile >outfile