User Tools

Site Tools


sed:convert:convert_dos_newlines_cr_lf_to_unix_format

SED - Convert - Convert DOS newlines (CR/LF) to Unix format

In UNIX Environments

sed 's/.$//'               # Assumes that all lines end with CR/LF.
sed 's/^M$//'              # In bash/tcsh, press Ctrl-V then Ctrl-M.
sed 's/\x0D$//'            # gsed 3.02.80, but top script is easier.

In DOS Environments

NOTE: Cannot be done with DOS versions of sed.

Use “tr” instead.

tr -d \r <infile >outfile            # GNU tr version 1.22 or higher
sed/convert/convert_dos_newlines_cr_lf_to_unix_format.txt · Last modified: 2020/08/16 11:14 by 192.168.1.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki