Programming Tips - bash: dos2unix command

Date: 2020oct22 Language: bash Q. bash: dos2unix command A. Here's a simple bash script that converts a DOS/Windows text file to Unix/Linux line endings in place. It uses tr to delete the CR characters. /usr/local/bin/d2u:
#!/usr/bin/bash set -euo pipefail for I in $*; do if [ -f $I ]; then cp $I $I.old tr -d '\r' < $I.old > $I rm $I.old fi done
Or you can install the dos2unix package