Created
August 29, 2015 17:37
-
-
Save Alambador/312464680c4377b2ca3b to your computer and use it in GitHub Desktop.
Converts a DOS text file to Unix format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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