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