Project

General

Profile

« Previous | Next » 

Revision 1481

row: Don't prepend header row because this feature prevents the program from being used on a pipeline. Sheets may be constructed in a pipeline if multiple segments need to be joined, e.g. with cat_csv.

View differences:

row
1 1
#!/bin/bash
2
# Gets a row of a spreadsheet, preceded by the header row. Designed for row #s
3
# in map error messages.
2
# Gets a row of a spreadsheet. Designed for row #s in map error messages.
4 3

  
5
if ! test "$#" -eq 2; then
6
    echo "Usage: $0 row_num (zero-based, excluding header) sheet >row_out"
4
if ! test "$#" -eq 1; then
5
    echo "Usage: $0 row_num (zero-based, excluding header) <sheet >row_out"
7 6
    exit 2
8 7
fi
9 8

  
10
head -1 "$2"
11 9
# Add 1 for header row and 1 for tail's 1-based row #s
12
tail -n +"$(($1+2))" "$2"|head -1
10
tail -n +"$(($1+2))"|head -1

Also available in: Unified diff