You're probably familiar with the LOCATE command, which is issued from the KEDIT command line to find text within your file. Even if you regularly use the LOCATE command, you might not be using some of these helpful features.
Here are three ways to use the LOCATE command more efficiently:
Here are some details about these three tips:
To search backwards through a file from the current line of the file that you are editing, you can enter the LOCATE command:
An equivalent, abbreviated, form of this is:
For instance, you may be looking at a file that is a chronological log of phone calls. You are looking for a call from "George" immediately before the call you are currently looking at. You would enter the command:
Or, you may want to find the last call from George. This call would be the last call in the file that had the string "George" in it since the file is kept in chronological order.
Instead of starting at the top of the file and searching forward through all the calls from George, you could go to the bottom of the file and search backwards. The first call that you found with "George" in it would be the most recent call from George. Here are the two commands to use to do that:
This technique of going to the bottom of the file and searching backwards is useful if you have an extremely large file that takes a long time to search and you are searching for text that you know is near the bottom of the file.
You can repeat the last LOCATE command that you issued by just entering the letter "L" in the command line. (You can use a lowercase "L".)
Using the above example of looking from the bottom of file upwards for the string "George", you would enter the commands:
and then you could continue to search backwards through the file for the string "George" just by entering the single-letter command "L" again and again, or by repeatedly press Shift+F1.
Normally, when you search for a string of text using the LOCATE command, the search starts at the current line of the file you are editing and goes to the bottom of the file where it stops.
If instead you want the LOCATE command to continue by wrapping around to the top of the file and continuing its search back to where it started, you should turn on the WRAP setting with the command:
SET WRAP ON
You can also turn WRAP ON by selecting Options/SET Command... and then finding the WRAP option in the list of options and checking the Enable Wrap button. To make this a permanent setting for all of your future KEDIT sessions, press the "Save Settings" button. Otherwise, WRAP will be ON only for your current KEDIT session.
Turning WRAP ON assures that you will find all occurrences of a string in the file you are editing and not just those occurences that exist between the current line and the bottom of the file. This is useful in some situations but not always.
The only notice you have that KEDIT has wrapped around to the top of the file, is the message "Wrapped...".
If you did not notice the message, this could cause a problem in situations where you actually want the command to stop working when you get to the end of the file.