Languages
[Edit]
EN

Bash - remove new line characters from file with tr command

6 points
Created by:
Kate_C
19800

Using Bash console it is possible to remove new line characters in following ways.

1. CRLF removing examples

1.1. File streams redirection

$ tr -d '\r\n' < input_file.txt > output_file.txt

1.2. Application streams redirection

$ cat input_file.txt | tr -d '\r\n' > output_file.txt

2. LF removing example

1.1. File streams redirection

$ tr -d '\n' < input_file.txt > output_file.txt

2.2. Application streams redirection

$ cat input_file.txt | tr -d '\n' > output_file.txt

 

Native Advertising
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join