MPE CI Programming for 7.5
July 22, 2008
Page 72
hp e3000
strategy
elseif '!entry' = 'read_match' then
# finds each "pattern" in "file" and echoes the record + line num
# input redirected to "!file”
setvar _grep_eof finfo("!file","eof")
setvar _grep_recno 0
setvar _grep_pat ups("!pattern")
while setvar(_grep_recno,_grep_recno+1) <= _grep_eof and &
setvar(_grep_rec, rtrim(input())) <> chr(1) do
if pos(_grep_pat,ups(_grep_rec)) > 0 then
echo !_grep_recno) !_grep_rec
setvar _grep_matches _grep_matches+1
endif
endwhile
return
endif
• 4667 msecs …
1669 records read -- 18 lines match "version”
• 4627 msecs …
1669 records read -- 0 lines match "foo"
CI grep (cont)