I have a file named file1 with following content:
The answer t
o your question
A conclusive a
nswer isn’t al
ways possible.
When in doubt, ask pe
ople to cite their so
urces, or to explain
Even if we don’t agre
e with you, or tell y
ou.
I would like to convert file1 into file2. Latter should look like this:
The answer to your question
A conclusive answer isn’t always possible.
When in doubt, ask people to cite their sources, or to explain
Even if we don’t agree with you, or tell you.
In case I simply execute cat file1 | tr -d "\n" > file2", all the newline characters will be deleted. Ho do delete only those newline characters, which are on the non-empty lines using the tr(1) utility?
-00is Perl’s “paragraph” mode, reading the input with one or more blank lines as the delimiter.-lappends the system newline character to the print command, so it’s safe to delete all newlines in the input.