When I am doing this:
echo -e "test1 test2 test3\ntest1 test2 test3" | awk '{print($2)}'
I get the printout:
test2
test2
but when I do like this:
test=`echo -e "test1 test2 test3\ntest1 test2 test3" | awk '{print($2)}'`
echo $test
I get the printout:
test2 test2
I want the result as a column as in the first example but also want it in a variable.
How can I do this?
Try quotes here:
should help.