Shell - add newline between columns in the output

Hi,

I have this command that Im running and getting this output:

count=$(sqlplus -s xxxx/xxxx@xxxx<<END
       set pagesize 0 feedback off verify off heading off echo off;
       select alarm_text, alarm_occurence, ALARM_PROGRAMINSTANCENAME, ALARM_CURRENTSEVERITY, ALARM_ACKEDBY from asdbc_alarm order by alarm_currentseverity;
       exit;
END
)
echo $count
~

Im getting this output out of it:
TS server load status 29-APR-15 mdm1a 3 TS server connection failure/established 29-APR-15 mdm1a 3 Address and port = training-app-01 10100 28-APR-15 dpns1a 4

I would like for it to be like this:
TS server load status 29-APR-15 mdm1a 3
TS server connection failure/established 29-APR-15 mdm1a 3
Address and port = training-app-01 10100 28-APR-15 dpns1a 4

---

Maybe I have to do a change in the sql command instead of adding the newline?

Tks,
Joao
joaotellesAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ozoCommented:
What output do you get from
echo "$count"
?
joaotellesAuthor Commented:
Im getting this output out of it:

TS server load status 29-APR-15 mdm1a 3 TS server connection failure/established 29-APR-15 mdm1a 3 Address and port = training-app-01 10100 28-APR-15 dpns1a 4


I would like for it to be like this:

TS server load status 29-APR-15 mdm1a 3
TS server connection failure/established 29-APR-15 mdm1a 3
Address and port = training-app-01 10100 28-APR-15 dpns1a 4

PS: this is the output now, there can be more or less lines, but always with the same number of fields.

Tks,
Joao
ozoCommented:
Are you saying that
echo "$count"
produces the same output as
echo $count
?
Is it also the same as the output of
sqlplus -s xxxx/xxxx@xxxx<<END
       set pagesize 0 feedback off verify off heading off echo off;
       select alarm_text, alarm_occurence, ALARM_PROGRAMINSTANCENAME, ALARM_CURRENTSEVERITY, ALARM_ACKEDBY from asdbc_alarm order by alarm_currentseverity;
       exit;
END
OWASP: Avoiding Hacker Tricks

Learn to build secure applications from the mindset of the hacker and avoid being exploited.

joaotellesAuthor Commented:
oh sorry I didnt notice the ""..

The one with "" gave me this:

TS server load status
29-APR-15 mdm1a                                    3


TS server connection failure/established
29-APR-15 mdm1a                                    3


Address and port = training-app-01 10100
28-APR-15 dpns1a                                    4
ozoCommented:
perl -e '$_=shift;s/(?<!\n)\n(?!\n)/ /g;s/(\s)\1+/$1/g;print' "$count"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
joaotellesAuthor Commented:
Tks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Shell Scripting

From novice to tech pro — start learning today.