commit 22260d4677378602d76e1ffa821d8f0a7588e85c parent f62be53907719efbce9eb61e8ef5ece382b76714 Author: Ed van Bruggen <edvb@uw.edu> Date: Mon, 21 Jan 2019 22:52:37 -0800 bin: Add body script Diffstat:
bin/body | | | 15 | +++++++++++++++ |
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/bin/body b/bin/body @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# body: print the body of a file +# +# if only two arguments are given print the file given by the first at the line +# number from the second. If a third argument is given print until that line. + +if [[ $# == 2 ]]; then + sed -n $2p $1 +elif [[ $# == 3 ]]; then + sed -n $2,$3p $1 +else + echo "usage: body FILE LINE [UNTIL]" + exit 1 +fi