How to convert space separated text to lines in Bash

bash, linux, string

Solution

You could use 'tr' to translate the space to a new line:

~$ echo 'foo bar boo you too' | tr ' ' '\n'
foo
bar
boo
you
too

Problem

I have a simple string: ``` foo bar boo you too ``` I'm looking for an easy way in bash on the command line (not in a script) to take this string in via a pipe or input redirection and convert it to ``` foo bar boo you too ```

Original source

Related problems