Find Command [F/F4]
Finds the next line in the workfile that contains a string. Use Findup if you want to search for the previous line. Find always finds a single line that matches a string. Use the List command if you want to find many lines that match a string.
FIND [string] [linenum]
FIND [string range] [linenum]
(Q=no display)
(Default: string = recent; linenum = *+1)
Find defaults string to be “same as last string” and linenum to be “starting from the next line”. This saves having to repeatedly type the string and linenum. Once you have defined your string and starting position, just enter “F” to find the next line.
Find does not start searching at the beginning of your file. Find will start searching for the string at the line after the current line, unless you specify a linenum to start the search. If you want to search from the beginning of your file, use Find string FIRST.
The F4 user key does the same function as Find with no parameters.
Examples
/find "exit" first {find first line with "exit"} 45 this command will cause an exit from the (28)^ /f {find next line with "exit"} 90 after you exit from a module, the program (11)^ /f {continue finding lines...} ... /f {...until you reach end of file} Warning: No Line {prints error and rewinds} Error: End of File /f {next Find wraps around!} Warning: Rewind to FIRST 45 this command will cause an exit from the (28)^ /fq"$page"(1/5);m {find next $page and modify it} /fq;c""exit" {find next string and change it} /fq;c""" {find next string and remove it} /f "start"/"end" [ {find string range and set ZZ} Lines 5/11 saved in ZZ
Notes
The Q option lets you find the line without printing it. Use FQ if you intend to Modify the line after you find it.
Find prints an error when the search reaches the LAST line without locating the string. Then, if you enter another Find without a line number, the search starts from the FIRST line in the file, after printing a warning.
See the /Qedit command for a command file that uses the Find command and checks the value of CIERROR to see if the string was found. The Find command only sets the CIERROR JCW when it is executed from a User Command. It does not set the JCW when executed from $stdin or from a usefile.
To find/see all occurrences of a string in a file, use the List command.
When a string range is used and a corresponding block is found, the start and end line numbers are stored in the ZZ marker.