Search code examples
linuxbashubuntuecho

No line breaks with "cat"


This code should read from wget2.html and output the links found. But it gives me output without line breaks. How can I force cat to add line breaks?

chksitename=$(cat wget2.html | grep -e "$sitename" | sed -e "s/^.*\("$sitename".*jpg\).*$/\1/g" | sort | uniq)
echo $chksitename

Solution

  • You could try:

    echo $chksitename | tr ' ' '\n'