read "rest" < $wrkdir/seeimds_cnt.asc

Hello

i have a function written in which i m running a read command which looks like following:
-----------------------------------------------------------------
generate_r_current() {
date
echo "step=$step"
db2 "select count(*),'QQQQQQ' from krms_stg.dcx_imds_r with ur" | grep 'QQQQQQ' > $wrkdir/seeimds_cnt.asc
RC=$?
checkRC 0
read cnt rest < $wrkdir/seeimds_cnt.asc if [[ "$cnt" = '0' ]]
then
sendIt "SCRIPT: $0\nSEEIMDS-Batch: No New Raw Data Received \nDATE: $(date)" "SEEIMDS-Batch - FYI"
fi
------------------------------------------------------------------
the 'read' statement confuses me as whats meant by 'rest'?I have scanned the whole script & don see 'rest' being mentioned/declared/used anywhere.

I went thru 'man read' but did not find anything about 'rest'.

Can anyone explain what this statement means?

Regards
Abhi

cnt and rest are both variables that receive input from your textfile. The default for read is to delimit fields based on whitespace.

It works like this:

$ ls temp.txt
temp.txt
$ cat temp.txt
1 one
2 two
3 three
$ read cnt rest < temp.txt
$ echo $cnt
1
$ echo $rest
one
$

If you have more fields on a line than you specify in the read command, then the last variable will be set to all remaining fields, i.e.:

$ cat temp.txt
1       one     uno
2       two     dos
3       three   tres
$ read cnt rest < temp.txt
$ echo $cnt
1
$ echo $rest
one uno
$

So, the rest variable in your script is being designated as the "rest" of the line after $cnt.