$ record 3 < inventory Item Amount Cost Value Description ---- ------ ---- ----- -------------- 3 5 80 400 clampsIf a second numeric argument is specified, record extracts the rows whose position is greater than or equal to the first argument and less than or equal to the second argument. For example,
$ record 2 6 < inventory Item Amount Cost Value Description ---- ------ ---- ----- -------------- 2 100 5 500 test tubes 3 5 80 400 clamps 4 23 19 437 plates 5 9 24 2376 cleaning cloth 6 89 147 13083 bunsen burners
The following shell script uses record and read to find specific values in a table. The read command uses the head line of inventory to assign values to each column name.
$ cat describe
: describe - gives the description for an item in inventory
USAGE='usage: describe Item < table'
record $1 < inventory |
( read HEAD
read DASH
read $HEAD
echo "Item $Item is $Description"
)
$ describe 1 < inventory
Item 1 is rubber gloves
SEE ALSO