Project

General

Profile

1 1480 aaronmk
#!/bin/bash
2 1534 aaronmk
# Gets row(s) of a spreadsheet. Designed for row #s in map error messages.
3
# Warning: Does *not* handle embedded newlines.
4 1480 aaronmk
5 1481 aaronmk
if ! test "$#" -eq 1; then
6 1534 aaronmk
    echo "Usage: env [n=...] $0 row_num (zero-based, excluding header) <sheet \
7
>row_out"
8 1480 aaronmk
    exit 2
9
fi
10
11 1534 aaronmk
test -n "$n" || n=1
12
13 1480 aaronmk
# Add 1 for header row and 1 for tail's 1-based row #s
14 1534 aaronmk
tail -n +"$(($1+2))"|head -"$n"