Converting From CRLF To LF: Difference between revisions

From SlackWiki
Jump to navigation Jump to search
(Copy from old, moved to Tips)
 
No edit summary
 
Line 7: Line 7:
  $ fromdos <input_file >output_file  # Converts CRLF to LF
  $ fromdos <input_file >output_file  # Converts CRLF to LF
  $ todos  <input_file >output_file  # Converts LF to CRLF
  $ todos  <input_file >output_file  # Converts LF to CRLF
Also you could play with tr (from CRLF to LF):
$ tr -d '\r' < input_file > output_file


[[Category:Tips]]
[[Category:Tips]]

Latest revision as of 23:17, 16 June 2010

Explanation

There are several ways of converting the CRLF combination to LF and vice-versa. The simplest one under Slackware is to use the tools fromdos and todos, which receive the file from the standard input and write the result to the standard output. They are part of the bin package.

Examples

$ fromdos <input_file >output_file   # Converts CRLF to LF
$ todos   <input_file >output_file   # Converts LF to CRLF

Also you could play with tr (from CRLF to LF):

$ tr -d '\r' < input_file > output_file