changeset 411:7da386057101

Add three commands that can be done as simple shell scripts (one sed is in, anyway), and don't need to be implemented in C.
author Rob Landley <rob@landley.net>
date Sun, 22 Jan 2012 20:33:15 -0600
parents 3d87f15f4c60
children 2b521c791e4e
files wrappers/dos2unix wrappers/tac wrappers/unix2dos
diffstat 3 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wrappers/dos2unix	Sun Jan 22 20:33:15 2012 -0600
@@ -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$//' "$@"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wrappers/tac	Sun Jan 22 20:33:15 2012 -0600
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wrappers/unix2dos	Sun Jan 22 20:33:15 2012 -0600
@@ -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/' "$@"