EN
Bash - remove new line characters from file with tr command
9
points
Using Bash console it is possible to remove newline characters in the following ways.
Quick solution:
tr -d '\r\n|\n\r|\n|\r' < input_file.txt > output_file.txt
1. CRLF
removing examples
tr -d '\r\n' < input_file.txt > output_file.txt
or:
cat input_file.txt | tr -d '\r\n' > output_file.txt
2. LF
removing example
tr -d '\n' < input_file.txt > output_file.txt
or:
cat input_file.txt | tr -d '\n' > output_file.txt