summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/hlp/absln17
-rwxr-xr-xbin/slt/r10
2 files changed, 27 insertions, 0 deletions
diff --git a/bin/hlp/absln b/bin/hlp/absln
new file mode 100755
index 0000000..be195a9
--- /dev/null
+++ b/bin/hlp/absln
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+# absln -- convert to absolute line
+
+test $# -ne 1 && { echo "usage: $0 line" 1>&2; exit 1; }
+case "$1" in
+'+'*)
+ test -z "${1#+}" && term=1 || term=${1#+}
+ expr `cat $EFP/line` + $term ;;
+'-'*)
+ test -z "${1#-}" && term=1 || term=${1#-}
+ expr `cat $EFP/line` - $term ;;
+.)
+ cat $EFP/line ;;
+*)
+ echo "$1" ;;
+esac
diff --git a/bin/slt/r b/bin/slt/r
new file mode 100755
index 0000000..5d2c184
--- /dev/null
+++ b/bin/slt/r
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+# r -- select line range
+
+test $# -ne 2 && { echo "usage: $0 start end" 1>&2; exit 1; }
+
+start=`absln $1`
+end=`absln $2`
+
+sed -n "$start,${end}p"