The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

Views: 76,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: November 24, 2022    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.

⇧ Quick-and-dirty way to ensure only one instance of a shell script is running at a time Is there graphical backup software that is not prone to consistency problems?  β‡©