Converting To Unix file format
Presentation
The files in Windows format may cause problems. But there is a small command line to change their format and convert them to Unix file format.
Converting a file from Windows to Unix
To do this, simply run the command:
sed -e "s/^V^M//" $1
The Script
Here is the dos2ux script, to transform a file in DOS format, to Unix format
#####################################################
# Script dos2ux #
# Autheur: Jerome DESMOULINS - Avril 2008 #
# http://www.desmoulins.fr #
#####################################################
# Converts a file back to Unix #
#####################################################
#Variables
TmpFile=/tmp/dos2ux_`date +%Y%m%d_%H%M%S`.tmp
#Convert to Unix format and save in a temporary file
sed -e "s/^V^M//" $1 > $TmpFile
#Writing the final file
rm $1
mv $TmpFile $1
Go back