Remove Special Chars from Windows files

Jul 2017

If you have copied any text files or text strings from a Windows PC, then you might find that there are still special characters in this file that stop you executing it as a script on a linux computer. These special characters are typically carriage returns and line feeds.
dos2unix vi -b filename

#!/bin/bash^M # Install useful tools^M ^M yum install epel-release -y^M yum install htop -y^M yum install nload -y^M yum install iperf -y^M yum install tcpdump -y^M yum install ncdu -y^M yum install net-tools -y^M rpm –import http://packages.atrpms.net/RPM-GPG-KEY.atrpms^M touch /etc/yum.repos.d/atrpms.repo^M echo “[atrpms]^M name=Fedora Core \$releasever - \$basearch - ATrpms^M baseurl=http://dl.atrpms.net/el\$releasever-\$basearch/atrpms/stable^M gpgkey=http://ATrpms.net/RPM-GPG-KEY.atrpms^M enabled=1^M gpgcheck=1” > /etc/yum.repos.d/atrpms.repo^M yum install ffmpeg -y ~