Add three commands that can be done as simple shell scripts (one sed is in, anyway...
authorRob Landley <rob@landley.net>
Mon, 23 Jan 2012 02:33:15 +0000 (20:33 -0600)
committerRob Landley <rob@landley.net>
Mon, 23 Jan 2012 02:33:15 +0000 (20:33 -0600)
wrappers/dos2unix [new file with mode: 0755]
wrappers/tac [new file with mode: 0755]
wrappers/unix2dos [new file with mode: 0755]

diff --git a/wrappers/dos2unix b/wrappers/dos2unix
new file mode 100755 (executable)
index 0000000..9eab664
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+#HELP usage: dos2unix [FILE...]\n\nRemove DOS newlines
+
+[ $# -ne 0 ] && DASH_I=-i
+sed $DASH_I -e 's/\r$//' "$@"
diff --git a/wrappers/tac b/wrappers/tac
new file mode 100755 (executable)
index 0000000..6253b70
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+# HELP usage: tac [FILE...]\n\nPrint input lines in reverse order
+
+for i in "$@"
+do
+  sed -e '1!G;h;$!d' "$i"
+done
diff --git a/wrappers/unix2dos b/wrappers/unix2dos
new file mode 100755 (executable)
index 0000000..68c1859
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+#HELP usage: unix2dos [FILE...]\n\nAdd DOS newlines
+
+[ $# -ne 0 ] && DASH_I=-i
+sed $DASH_I -e 's/$/\r/' "$@"