Project

General

Profile

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 <sheet >row_out
7
Note: Row #s start with 1 after the header (which is row 0)"|fold -s >&2
8
    exit 2
9
fi
10

    
11
test -n "$n" || n=1
12

    
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"
(55-55/69)