Skip to content

Instantly share code, notes, and snippets.

@Alambador
Created August 29, 2015 17:37
Show Gist options
  • Save Alambador/312464680c4377b2ca3b to your computer and use it in GitHub Desktop.
Save Alambador/312464680c4377b2ca3b to your computer and use it in GitHub Desktop.
Converts a DOS text file to Unix format
#!/usr/bin/bash
if [ -z "$1" ]
then
echo "Usage: `basename $0` filename-to-convert"
exit 1
fi
# Lines in a DOS text file end in a CR-LF.
CR='\015' # Carriage return.
# Delete CR and write to new file.
tr -d $CR < $1
# Source: http://www.linuxquestions.org/questions/programming-9/unix-to-dos-text-55231/#post278138
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment