Pipe the 'grep' output to 'awk', like this:
Code:
grep 'echo' gettab | awk '{printf("%s ",$0)}END{print}'
This command does a grep for 'echo' in the file 'gettab'. The output will be captured by awk which will print every inputline ($0) as a string to stdout without a newline (\n), which otherwise had to be explicitly defined as "%s\n" in printf. The END section will eventually append a newline to conclude the output of the command.
BTW: The printf function also exists in the schell commandset but I couldn't find out how to pass the grep outputline to it as an argument.
Regards