Text Location Commands [ HP EDIT Reference Manual ] MPE/iX 5.0 Documentation
HP EDIT Reference Manual
Text Location Commands
During your editing session, you may need to quickly find a string of
text. HP EDIT provides a group of commands that enable you to find a
specific character or group of characters. In addition, HP EDIT also
enables you to find text strings and replace them with substitute text.
To assist you in the task of finding text, HP EDIT also provides several
commands that enable you to set and access place markers. These place
markers, called marks, are very useful for block cut and paste
operations.
Single Character Searches
The single character commands enable you to find occurrences of
individual characters. The command names for this group of commands are
as follows:
Find All Occurrences
Find Character
Find Previous Character
Find Blank Space
Find Previous Blank Space
Find .
Find Previous .
Find Matching Delimiter
Except for the Find Matching Delimiter command, this group of commands
enables you to search forward or backward for a specified character,
blank space, or period. The Find Matching Delimiter command enables you
to locate the matching member of a delimiter pair, such as a right
bracket (]). Valid search delimiters are brackets, braces, and
parentheses.
Except for the Find Matching Delimiter command, you can specify a count
before executing any of these commands to find a particular occurrence of
a given character. For instance, you would type the number 5 before
executing the Find Character command to locate the fifth forward
occurrence of a specified character from the current cursor position.
[REV BEG]
You can execute the find commands within an explicit block to define the
limits of the find command[REV END].
Pattern Definitions
If you want to search for a string of text more than one character in
length, you must first define a search pattern before you can search for
the text. Similarly, if you want to replace an occurrence of the search
pattern with other text, you should first define a replacement string
before searching for and replacing text. Pattern definition functions
and their associated commands are as follows:
* Defining search patterns
Define Search Pattern
Insert Search Pattern
Define Search Pattern From Text
* Defining replacement patterns
Define Replace Pattern
Insert Replace Pattern
Define Replace Pattern From Text
Defining Search Patterns.
You define a search pattern by using the Define Search Pattern command
and providing the desired search string when prompted by HP EDIT. The
search pattern remains until you execute the command again and specify
another search pattern. Special pattern-matching characters enable you
to define search patterns that satisfy certain criteria and exclude other
criteria.
After you define the search pattern, you may want to subsequently edit
the pattern later during the session, rather than define a totally new
pattern. The Insert Search Pattern command enables you to insert the
current search pattern within text so you can modify it. After you have
altered the search pattern, you can use the Define Search Pattern From
Text command to designate the current line of text containing the edited
search pattern as the new search pattern.
Defining Replacement Patterns.
You similarly define a replacement pattern as you would define a search
pattern. Consequently, the Define Replace Pattern, Insert Replace
Pattern, and Define Replace Pattern From Text commands function almost
identically to the search commands described above. They differ only in
that pattern-matching characters are not recognized or used in a
replacement string.
[REV BEG]
You can also define replace patterns by using double quotes in the Define
Search Pattern, Define Search Pattern From Macro, and Define Search
Pattern From Text commands.
The rules for using double quotes in the define search commands are as
follows:
* If the string contains only one double quote ("), it is treated as
one double quote.
* If the string begins and ends with a double quote, the string is
defined as the text between the double quotes.
* If the string has only a leading double quote, the double quote is
not defined in the string.
* If the string only ends with a double quote, the double quote is
treated as part of the pattern.
* The double quote is not part of the pattern-matching character
set, so the way the double quote is handled is not affected by
setting the "Pattern Matching Chars" option.
[REV END]
Search And Replace
After you have defined a search pattern, you can execute the appropriate
command to find the search pattern within text. If you have defined both
a search pattern and a replace pattern, you can execute the appropriate
command to find the search pattern within text and replace it with other
text. Search and replace functions and their associated commands are as
follows:
* Searching for text
Search Forward
Search Backward
* Searching for and replacing text
Search And Replace Forward
Search And Replace Backward
Global Search And Replace Forward
Global Search And Replace Backward
Searching for Text.
The search commands locate one or more occurrences of text matching a
predefined search pattern. The Search Forward command searches from the
current cursor location to the bottom of the file for the search pattern.
The Search Backward command searches from the current cursor location to
the top of the file for the search pattern.
Searching for And Replacing Text.
The search and replace commands locate one or more occurrences of text
matching the predefined search pattern and replace them with text from a
predefined replacement pattern. The Search And Replace Forward command
searches from the current cursor location to the bottom of the file for
the search pattern. If HP EDIT finds an occurrence of the pattern, it
pauses by prompting you with five response choices. The Search And
Replace Backward command performs the same operation, except it searches
from the current cursor location to the top of file for the search
pattern.
The global versions of the search and replace commands do not prompt for
your response. By executing one of the global commands, you permit HP
EDIT to locate and replace all occurrences of the search pattern either
forward or backward from the current cursor location.
Note that if you execute an undo command after executing a search and
replace command, HP EDIT undoes all of the occurrences that the search
and replace command altered.
Place Markers
During your editing session, you may quickly need to access a certain
portion of your file or measure the distance of a block of text for cut
and paste operations. HP EDIT enables you to insert up to ten invisible
place markers within a file. After you have set the desired number of
marks, you can use them as reference points for various related commands.
Place marker functions and their associated commands are as follows:
* Setting markers
Set Mark
* Setting distances
Set Distance To Mark
Set Distance To Previous Location
* Moving to a marker
Go To Column/Mark
Go To Line/Mark
* Swapping locations
Swap Cursor With Mark
Swap With Previous Location
Defining Markers.
Before you can use a place marker, you must first set the marker using
the Set Mark command. After you have set from one to ten marks, each
remains at the defined location until you set that mark at another
location or delete the line containing the mark. After you have set one
or more marks, you can execute the Show Editor Statistics command to
display all currently set marks and their respective line and column
locations.
[REV DEL]
Setting Distances.
You can use the Set Distance To Mark and Set Distance To Previous
Location commands to calculate the number of lines between the current
cursor position and a specified mark. Used in conjunction with the Set
Mark command, these commands are useful for establishing the count for
block sections of text as explained in the preceding paragraph.
Moving to A Mark.
As mentioned in the section that discusses cursor movement commands, the
Go To Column/Mark and Go To Line/Mark commands serve a dual purpose. You
can use them either to move the cursor to a specific column or line, or
to move to a particular mark. To move to a mark, you would type a count
representing the mark you want to move to, then you would execute either
command.
Swapping Locations.
The swap commands exchange the position of the cursor with a specified
mark or with the previous location mark (mark 11), which is set whenever
the cursor moves up or down by more than a screenful.
MPE/iX 5.0 Documentation