Converting rows into columns

hi all

I need a help ..I have a script that takes has command and its output is like below..

 a b
 a v v
 a c

I am assigning the above outputs to a variable ..

<variable name> = <command output>

problem here is when I echo the variable ..it gives me output like " a b a v v a c "

I need help to convert the output as like the command output line by line instead of continuous row..

pls help here

shan

What command would that be.
Could you show the code?

I think you simply need to quote the variable you're echo-ing. Let me know if this is of any help.

$ #simulating multi-line output
$ echo "abc def
ab cd ef
123 456 789"
abc def
ab cd ef
123 456 789
$
$ #assigning multi-line output to a variable
$ var=$(echo "abc def
> ab cd ef
> 123 456 789")
$
$ #echo-ing unqouted variable
$ echo $var
abc def ab cd ef 123 456 789
$
$ #echo-ing quoted variable
$ echo "$var"
abc def
ab cd ef
123 456 789
$

perfect..it worked..thanks a lot for your reply.