73 lines
1.3 KiB
Groff
73 lines
1.3 KiB
Groff
.TH record "" "" "/rdb Command"
|
|
.PC "Find and output a record from a table"
|
|
\fBrecord \fInumber \fB< \fItable\fR
|
|
.PP
|
|
.II "row^find r. by number"
|
|
.II "find record by number"
|
|
The command
|
|
.B record
|
|
searches through
|
|
.I table
|
|
for the record with the serial number
|
|
.IR number .
|
|
If it finds the record, it prints it and the table's header on the
|
|
standard output.
|
|
.SH Example
|
|
To retrieve the third record from table
|
|
.BR inventory ,
|
|
type:
|
|
.DM
|
|
record 3 < inventory
|
|
.DE
|
|
.PP
|
|
You will see something like the following:
|
|
.DM
|
|
Item Amount Cost Value Description
|
|
---- ------ ---- ----- --------------
|
|
3 5 80 400 clamps
|
|
.DE
|
|
.PP
|
|
The following shell script uses
|
|
.B record
|
|
and
|
|
.B read
|
|
to find specific values in table
|
|
.BR inventory .
|
|
The command
|
|
.B read
|
|
uses the head line of
|
|
.B inventory
|
|
to assign values to each column name.
|
|
.DM
|
|
: describe - gives the description for an item in inventory
|
|
USAGE='usage: describe Item < table'
|
|
.sp \n(pDu
|
|
record $1 < inventory |
|
|
( read HEAD
|
|
read DASH
|
|
read $HEAD
|
|
echo "Item $Item is $Description"
|
|
)
|
|
.DE
|
|
.PP
|
|
When you type
|
|
.DM
|
|
describe 1 < inventory
|
|
.DE
|
|
.PP
|
|
you see output in the following format:
|
|
.DM
|
|
Item 1 is rubber gloves
|
|
.DE
|
|
.SH "See Also"
|
|
.B
|
|
row,
|
|
search
|
|
.R
|
|
.br
|
|
COHERENT Lexicon:
|
|
.B
|
|
read
|
|
.R
|
|
.SO record
|