I have two queries that I am running against two different systems. They each return one row, and I want to output them on a single line.
if the queries produce results similar to:
echo this that and more
echo other great news
I want to be able to do some reordering and formatting like so:
echo other this that great news and more
If I could figure out how to echo the output of the line into multiple variables I would be good. I got this to work:
echo this that and more | while IFS=" ", read a b c
do
echo a=$a b=$b c=$c
done
But once I am out of the while loop the variables a b and c are out of scope and no longer have their values.
IFS=" "a typo, or in your actual code?tr -d '\n'to delete the newline character ortr '\n' ' 'to substitute with space ?