nixCraft published a tutorial about how to remove carriage return in Linux.
How to remove carriage return in Linux or Unix
Explains how to remove carriage return (^M or \r) in Linux, macOS, *BSD or Unix using sed, tr, Perl, dos2unix command-line utilities.
How to remove carriage return in Linux or Unix - nixCraft