diff tools/rdock/bin/to_unix @ 0:bc03dbb6eb37 draft

planemo upload commit 781926e52355f7805db8d9a4ccafeff397b19aa4-dirty
author marpiech
date Mon, 29 Aug 2016 03:38:13 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/rdock/bin/to_unix	Mon Aug 29 03:38:13 2016 -0400
@@ -0,0 +1,32 @@
+#! /bin/sh -e
+#Tag 1538
+#
+# convert a DOS ASCII file to a UNIX ASCII file by removing trailing ^M at the
+# end of each line and ^Z at the end of the file
+
+#DM 23 Oct 2000 - tmp file in current directory, not /tmp
+#TMPFILE=/tmp/to_unix$$
+TMPFILE=to_unix$$
+
+if [ $# -gt 2 ]
+then
+	echo "usage: to_unix [<dos_file> [<unix_file>]]"
+	exit 1
+fi
+
+# First strip out all carriage-return and ctrl-Z's
+if [ $# -gt 0 ]
+then
+	tr -d '\015\032' < "$1" > $TMPFILE
+else
+	tr -d '\015\032' > $TMPFILE
+fi
+
+
+if [ $# -eq 2 ]
+then
+	mv -f $TMPFILE "$2"
+else
+	cat $TMPFILE
+	rm $TMPFILE
+fi