$ cat temp.txt
hello, world!
$ cat temp.txt | sed -n '1,4p'
hello, world!
$ ret=$(cat temp.txt | sed -n '1,4p')
$ echo "$ret"
hello, world!
$
I am wondering why the $ret variable does not have the empty lines.
Much appreciated for the help.