I have an assignment where I have to put every occurence of a word starting with an l into the Variable FOO, with a new line starting after every word.
So I used grep -i -w -o "l[A-Z]*" lipsum.txt which Outputs
Lorem
labore
laboris
laborum
each in a new line. So I used FOO=$(grep -i -w -o "l[A-Z]*" lipsum.txt) and then used echo $FOO to test it, but it printed all 4 in the same line. Is this a problem with echo or is it actually like that in the variable? How do I fix it?