Converts text files from M$ (CR/LF) to Linux (LF) , and vice-versa

Solution 1:
Much more simple, edit file with vim and do: :set ff=unix

Solution 2:
Well if you need convert some files that was develop with M$ and remove ^M in Linux. You may use tofodos and you may run this simple script to convert files from some directories:
find . -type f -exec dos2unix {} \;
find . -type f -exec sh -c 'file --mime-encoding "{}" | grep -qv "binary$"' \; -print | while read file; do sed -i -e '$a\' $file; done

But other problem, some M$ files don't have an eof (end of line) in last line of the file, just have an eof (end of file)
On vim we see [noeol] when edit the M$ file. This information have several years, I don't know if they have fixed it meantime.