With grep -o, I have a new line for every match:
# echo "a b a"|grep -o a
a
a
How can I obtain the following result?
# echo "a b a"|grep -o a
a a
With grep -o, I have a new line for every match:
# echo "a b a"|grep -o a
a
a
How can I obtain the following result?
# echo "a b a"|grep -o a
a a
You can pipe the output of grep to tr that you can then use to translate \n (newline) to \t (tab):
echo "a b a" | grep -o a | tr "\n" "\t"; echo
where the last echo is used to prevent the output of tr from being on the same line as your PS1.
For the specific example you give, this is how it looks like:
$ echo "a b a" | grep -o a | tr "\n" "\t"; echo
a a