Frequently Asked Questions for FreeBSD 2.X
: System Administration
: How do I reformat DOS text files to UNIX ones?
Previous: How do I keep Control-Alt-Delete from rebooting the system?
Next: How do I kill processes by name?
8.22. How do I reformat DOS text files to UNIX ones?
Simply use this perl command:
perl -i.bak -npe 's/\r\n/\n/g' file ...
file is the file(s) to process. The modification is done in-place,
with the original file stored with a .bak extension.
Alternatively you can use the tr(1) command:
tr -d '\r' < dos-text-file > unix-file
dos-text-file is the file containing DOS text while
unix-file will contain the converted output. This can
be quite a bit faster than using perl.
Frequently Asked Questions for FreeBSD 2.X
: System Administration
: How do I reformat DOS text files to UNIX ones?
Previous: How do I keep Control-Alt-Delete from rebooting the system?
Next: How do I kill processes by name?