.TH seek "" "" "/rdb Command" .PC "Return the beginning and ending offset of a row" \fBseek [-m[bihrs]] [-o \fIoutfile\fB] \fItableorlist \fB[\fIkeycol...\fB] < \fIfile\fR .PP .II "row^find" .II "row^offset" .II "find row" The command .B seek returns the offsets of the beginning and end of a record in .IR tableorlist . It uses the command .B search with its location option .BR \-l . .PP The offset and size integers returned can be used by the .B replace to write a new record. They are also used by the commands .B lock and .B unlock to set and remove record locks. .SH Options .B seek recognizes the following options: .IP \fB-m[bhirs]\fR Fast access methods. See the manual entry for the command .B search for a full description of various search options and how you can invoke each. .IP \fB-o\fR Write the found record into .BR outfile . .SH Example Let's use .B seek on the table .BR inventory , which is as follows: .DM Item Amount Cost Value Description ---- ------ ---- ----- -------------- 1 3 50 150 rubber gloves 2 100 5 500 test tubes 3 5 80 400 clamps 4 23 19 437 plates 5 99 24 2376 cleaning cloth 6 89 147 13083 bunsen burners 7 5 175 875 scales .DE .PP The following command invokes .B seek to find row 5: .DM echo 5 | seek -mb inventory Item .DE .PP This writes the following to the standard output: .DM 207 245 0 8 .DE .PP This means that the record is 207 bytes into the file and that it is 38 bytes long, ending at byte 245. .PP The next example extracts a row from .BR inventory blanks it out, then writes the row back into .B inventory on top of the original row. First, extract the row: .DM LOCATION=`echo 5 | seek -mb -o tmp inventory Item` .DE .PP The location of the selected record is stored in environmental variable .BR LOCATION . The option .B "\-o tmp" writes the record with key equal to 5 into table .BR tmp , which appears as follows: .DM Item Amount Cost Value Description ---- ------ ---- ----- -------------- 5 99 24 2376 cleaning cloth .DE .PP The next command blanks the contents of .BR tmp , then writes the blanked row back into .B inventory at the location stored earlier at .BR LOCATION : .DM blank < tmp | replace inventory $LOCATION .DE .PP .B inventory now appears as follows: .DM Item Amount Cost Value Description ---- ------ ---- ----- -------------- 1 3 50 150 rubber gloves 2 100 5 500 test tubes 3 5 80 400 clamps 4 23 19 437 plates .sp \n(pDu 6 89 147 13083 bunsen burners 7 5 175 875 scales .DE .SH "See Also" .B index, lock, replace, search, unlock .R .SO seek