To read all the lines, regardless of whether they are ended with a new line or not:
echo "$(cat "somefile")" | { cat ; echo ; } | while read line; do echo $line; done
Source : My open source project https://sourceforge.net/projects/command-output-to-html-table/