The newline character in Windows is
\r\n, and in Linux is
\n. Linux cannot recognize the
\r identifier and will treat it as part of the text content.
You can use
dos2unix to convert it permanently (
dos2unix list.txt) or you could do it on the fly by setting
while IFS=$'\r' read -r filename || [[ $filename ]] do echo "do something with $filename" done < list.txt
CLICK HERE to find out more related problems solutions.