I already tried using sed
, now I'm using tr
,
list="banana, apple, orange, strawberry"
listed_text=$(echo $list| tr , '\n')
Desired output:
banana
apple
orange
strawberry
Output I get:
banana apple orange strawberry
I'm using zsh as shell, but I checked in bash and it also doesn't work. I tried \n, \n, tried an literal newline "\ "
but it won't work. All I get is t that same single line output!