Revision 1946
Added by Aaron Marcuse-Kubitza almost 13 years ago
row | ||
---|---|---|
3 | 3 |
# Warning: Does *not* handle embedded newlines. |
4 | 4 |
|
5 | 5 |
if ! test "$#" -eq 1; then |
6 |
echo "Usage: env [n=...] $0 row_num (zero-based, excluding header) <sheet \
|
|
7 |
>row_out"
|
|
6 |
echo "Usage: env [n=...] $0 row_num <sheet >row_out
|
|
7 |
Note: Row #s start with 1 after the header (which is row 0)"
|
|
8 | 8 |
exit 2 |
9 | 9 |
fi |
10 | 10 |
|
11 | 11 |
test -n "$n" || n=1 |
12 | 12 |
|
13 |
# Add 1 for header row and 1 for tail's 1-based row #s |
|
14 |
tail -n +"$(($1+2))"|head -"$n" |
|
13 |
# Add 1 for header row (tail has 1-based row #s, so don't need to add 1 more) |
|
14 |
tail -n +"$(($1+1))"|head -"$n" |
Also available in: Unified diff
Made row #s 1-based to the user to match up with the staging table row #s