LOCATE [col1 [col2]] [/string/[H][I]] L
Related commands: RLOCATE, NLOCATE, RNLOCATE/NRLOCATE
LOCATE is used to search for character strings.
As parameter you specify a character string. The latter is embedded
in two delimiters. In the general syntax above, a slash
(`/
') is used as delimiter but any other
character is possible as well. In practice, the special character
on the lower right on the keyboard has proved to be helpful. When
you get used to this key as general delimiter, you will only have
to use another character if the special character occurs in the
character string to search for. You may leave out the delimiter at
the end of the character string if the rest of the command line is empty.
locate /abc/
searches for the character string `abc
',
l -a/b-
searches for the character string `a/b
',
l abc
searches for the character string `bc
' because
`a
' is the first delimiter and the second delimiter
is missing. l abca would search for the character string
`bc
' as well.
Please, note that you have to use the final delimiter if you concatenate the LOCATE command with other commands:
l /abc/;-2
searches for the string `abc
' and then executes
the command -2 while
l /abc ;-2
would search for the string `abc ;-2
'.
The search begins at the record after the one in the current line.
If the character string is found, the record containing the string appears in the current line. The section displayed in the workfile is moved according to the change.
Contrasting, if the character string is not found, the following message appears:
Character string not found: ...
In the output in the window the ... are replaced by the string searched for. In this case, the current line remains unchanged.
If exaEdit could not find the character string in the last record of the workfile, normally the search continues at the first record either until the character string is found or until the initial record of the search is reached. `Normally' means that the switch manipulated by the command WRAP is ON.
To show you that the search continued at the beginning of the workfile, the message
Search from begin (wrap)
is generated. This message is followed by either the positioning of the workfile section when the character string is found or the negative message from above when the string is not detected.
Anyway, if WRAP OFF is valid, the search ends at the
last record of the workfile.
If the search was not successful, the messages
End of data
Character string not found: ...
are generated.
Frequently, it is necessary to search for the same character string more than once. In this case, it is sufficient to enter LOCATE without any parameter: The last character string that has been searched for is used automatically.
The commands LOCATE, RLOCATE, NLOCATE and RNLOCATE/NRLOCATE use the same character string. The character string to be searched for is the same for all workfiles.
By default, the complete record will be searched. By giving two column numbers as first parameters the search is restricted to that area. A character string will then only be found if the given area contains it fully. If only one column number is given, the search area goes from that column to the end of the record. The command ZONE can also be used for column restrictions (see description). When both ZONE and the column number parameters are in effect, the latter one precedes.
If LOCATE is used a second time, and then without any parameters, possible column restrictions are still in effect. But if a new search string is given, the restrictions are no longer in effect. A LOCATE with a (new) column restriction after another LOCATE will use the same search string as the first LOCATE.
You can search for data in hexadecimal form by giving the parameter
H
Odd number of hex characters
Wrong hex character
locate /09/ h
When the parameter
I
locate /ab/ i
If you have to use the parameter I regularly, the use of the command CASE is recommended. CASE can force other commands to act as if the parameter I was given. For further information see CASE.