|Command||up.a Command/Update Processor
Applicable release versions: AP
|Category||Update Processor (113)|
|Description||search for a specified text string and replace it with another string if necessary.
The search and replace capabilities allow you to do the following:
- Search for text
- Search for text and replace the text, and
- Search for text and, once the text is found, determine whether or not to replace it.
See "spelling checker" for other uses of "<ctrl>+a". All of the possible command sequences are listed below.
Searching for a string: To search for a string, enter <ctrl>+a as follows:
When "<ctrl>+a" is issued, UP prompts with "search for:" at the top of the screen. Enter the "string" followed by a <return>.
If the "string" is found, the cursor is displayed on the first character of the matched "string"; otherwise, the terminal beeps and the cursor remains at its current location and the message "...string not found ..." displays on the terminal.
The search "string" is not case-sensitive. To search for letters that are case-specific, enclose the "string" in single or double quotation marks.
To search for a string containing quotes, the string must be included in alternate quotes. For example, the string '"' would find one double-quote, if present in the item.
Repeating the last search: If the previous operation was a simple search and the cursor is still positioned on the most recently found "string", you can enter the <ctrl>+a command to invoke the search again and find the next occurence of the string. If the cursor has been moved off of the most recently executed search string, the "search for:" prompt reappears.
Searching and replacing all occurences of a string: If you want to search for a string and replace all occurrences with a replacement string, use <ctrl>+a as follows:
When "<ctrl>+r" is issued, UP prompts with "replace with:". "<ctrl>+n" searches for and replaces every occurence of the "string" with the "replace.string" from the current position of the cursor to the end of the item with no further prompting.
The "string" is replaced as entered; however, if the replacement is at the beginning of a sentence, the initial letter is replaced as an upper-case letter. To specify an exact replacement of upper-case and lower-case letters, enclose the text in single or double quotation marks.
Selective search and replace: To search for a string and selectively replace with a replacement string, use <ctrl>+a as follows:
In this form, UP searches for the next occurence of the "string". If a match is found, the cursor is displayed on the first character of the matched "string" and UP waits for one of the following four commands:
Does not replace the current "string" and locates the next occurence of "string".
Replaces current and all further occurences of "string" with "replace.string"
Replaces current "string" with "replace.string" and searches for the next occurence of "string".
Terminates the search and returns to edit mode.
If none of the above commands are provided at this prompt, the process displays a message on the top line of the terminal indicating the valid responses it will accept.
Searching and deleting strings: To remove all occurences of "string" without replacement, the following sequence of commands may be used:
Search for "joe's bar", then repeat search. <ctrl>+a search for:"joe's bar"<return> <ctrl>+a Search and replace all occurences of "joe's bar" with "sam's pub". <ctrl>+a search for:"joe's bar"<ctrl>+r replace with:"sam's pub"<ctrl>+n Search for and delete all occurences of "joe's bar" from current positon of the cursor to the end of the item. <ctrl>+a search for:"joe's bar"<ctrl>+r replace with:<ctrl>+n