[Refdb-cvs] CVS: refdb/scripts refdb_dos2unix.in,NONE,1.1.2.1
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2005-03-29 20:35:15
|
Update of /cvsroot/refdb/refdb/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24982 Added Files: Tag: Release_0_9_5_stable refdb_dos2unix.in Log Message: replaces dos2unix.in --- NEW FILE --- #!<myshell> # dos2unix - converts files with DOS-style line endings to Unix-style # this implementation is just a semi-intelligent wrapper # for tr # Markus Hoenicka <ma...@mh...> 010930 # $Id: refdb_dos2unix.in,v 1.1.2.1 2005/03/29 20:35:06 mhoenicka Exp $ # OPTIONS: -h (invoke help) # relies on these external programs: tr ### start user-customizable section ### end user-customizable section # read the command line options while getopts ":h" opt; do case $opt in h ) echo "converts files with DOS line ending (\\r\\n) to UNIX (\\n)" echo 'usage: dos2unix [-h] file1 [file2...]' echo "Options: -h print this help and exit" exit 0 ;; \? ) echo 'usage: dos2unix [-h] file1 [file2...]' exit 1;; esac done # correct the index so the filename argument is always $1 shift $(($OPTIND - 1)) for filename in $*; do tr -d '\r' < $filename > $filename.$$ mv $filename.$$ $filename done exit 0 |