Views:
90,624β
Votes: 4β
Tags:
command-line
scripts
text-processing
Link:
π See Original Answer on Ask Ubuntu β§ π
URL:
https://askubuntu.com/q/1016826
Title:
How can I print multiline output on the same line?
ID:
/2018/03/17/How-can-I-print-multiline-output-on-the-same-line_
Created:
March 17, 2018
Edited: March 17, 2018
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
This answer has a solution to the problem you are trying to create: Why does bash remove \n in $(cat file)?
If you type cat myfile.txt
you will see:
abc
def
ghi
But if you type echo $(cat myfile.txt)
you will see:
abc def ghi
Note this method inserts a space where separate new lines used to be. This makes the output easier to read but doesnβt strictly adhere to your question scope.