Modify Command [M]
Editing characters within lines using either Control codes (default Set Mod Robelle), D-I-R-U edits (Set Mod HP), or Control codes with visible feedback (Set Mod Qzmod).
MODIFY rangelist
(Q=no linenum, T=template)
(Default: rangelist = *)
By default, Modify displays the first line and puts the cursor under the first column. You enter an "edit-line" to specify a changes. You use spaces to move the cursor under the word you want to change, then type new characters to replace those in the columns above. For example:
/modify 5
5 Over 2000 computers use Suprtool. {prints line}
750 {you edit it}
5 Over 2750 computers use Suprtool. {prints new line}
<Return> {end Modify}
Each time you press Return, Modify applies your changes to the line and prints the new result. This cycle continues until you enter only a Return (no more edits).
You use nonprinting Control codes for editing, such as Control-D to delete. For visual feedback, do Set Mod Qzmod, which puts your cursor right on top of the line and responds to each Control code by revising the image on the screen (i.e., Control-D actually makes the character disappear from the screen). If you would prefer to use MPE-style edits (D-I-R-U) instead of Control Codes, do Set Mod HP to reconfigure Modify.
To force the line number onto a separate line, use Set Mod Prompt OFF.
Examples
/modify 5/ {modify from line 5 until ^Y or end}
/find "corelate";m {find spelling error and modify line}
/mod "q_flag" {modify all lines with "q_flag"}
Getting into Modify Mode
There are other commands that invoke Modify mode in Qedit:
- Change, when a line overflows or you use CJ.
- Add, when you use the auto modify character from Set Zip.
- Before, so that you can revise and redo a previous command.
- Redo, also enables you to revise and redo a previous command.
Edit Functions of Modify
Here are the edit functions of Modify and their Control codes, which may be changed with the Set Modify command.
Function | Key | Purpose |
Overwrite | Control-O | Replace characters (default). |
Delete | Control-D | Delete characters. |
Before | Control-B | Insert characters before a column. |
Append | Control-A | Add characters to end of the line. |
Divide | Control-V | Divide line in two at this column. |
Goof | Control-G | Restart Modify with original line. |
Terminate | Control-T | End this edit so you can do another. |
Lengthen | Control-L | Same as Append (Control-A). |
Insert | Control-^ | Same as Before (Control-B). |
HP-UX reacts to certain control characters which might conflict with the Qzmodify codes. For example, control-D sends an end-of-file signal to HP-UX but is also the delete character in Qzmodify. You should use the HP-UX stty
program to change the default end-of-file signal. Please see the section Control Characters and stty for more details.
You create Control codes by holding down the Control key while pressing the other key. Most Control codes are invisible and do not move the cursor. In the user manual, the symbol (^) as a prefix stands for the Control key (^-D for Control-D).
Some functions combine two of the Control codes: pressing ^-T then ^-V in the first column of a line splices two lines together (and deletes the second line if it's emptied). Actions not restricted to column 1 may be performed at any point on the line.
Function | Key | Col. | Purpose |
Splice | ^T ^V | 1 | Fills current line from next line. |
Insert Line | ^A ^V | 1 | Adds a blank line before current one. |
Insert Line | ^A ^V | Adds a blank line after current line. | |
Delete Last | ^A ^D | Spaces remove characters at end of line. | |
Replace End | ^A ^O | Replaces from end of line (overwrites). | |
Delete Line | ^T ^D | 1 | Deletes current line. |
Overwriting Characters
To overwrite characters in a line, type the new characters underneath the ones to be replaced. There is no need to type a control character; "overwrite" is the default edit function. Once you are in Overwrite mode, you can also use the Space bar to erase the columns that you move through. If you have not yet typed any characters, the Space bar just moves your column position to the right one place. You can get into Overwrite mode at any time while in modify by pressing Control-O. Terminate overwrite mode and go into space- transparency mode by typing Control-T.
Start Over Editing a Line
To correct a Modify mistake, enter the Goof control code (Control-G) and press Return. Qedit restores the line to its original contents and restarts the Modify cycle. Control-G does not undo Splits and Splices.
Doing Several Edits in One Line
You can do more than one edit operation in one edit-line if each edit is clearly separated from the preceding and following ones. When the edits are at different ends of the line, you must Terminate the first function so that you can move the cursor right to the next column. The Terminate control code (Control-T) provides this capability.
The following illustrates where to place your control codes (^ stands for the Control key), even though they will not appear on your screen. The first example capitalizes the "r" in "return", then replaces "in error" with "by mistake", which requires inserting the letters "ke." The second example inserts the word "Goof" and a space at the start of the line, and deletes the last two words at the end of the sentence, adding a final period.
/m 13
13 a return. If you do this in error, {displays line}
R by mistake {^codes are: }
<spaces> R<^T, spaces> by mista<^B>ke<Return>
13 a Return. If you do this by mistake, {redisplays}
/m+1
14 control code restores the line for you. {displays line}
Goof . {^codes are: }
<^B>Goof <^T, spaces> .<^D, Return>
14 Goof control code restores the line. {redisplays}
Deleting Characters
To delete characters from the line, starting with the current column position, enter the Delete control code (Control-D). Then space to the right the number of columns to be deleted. Any remaining characters in the line are left-shifted to fill in the deleted columns.
In all cases, the columns deleted are those immediately above the cursor, regardless of what other functions have been performed previously on the same line. The Delete function is stopped by the first nonblank character, either Return, a printing character to switch back into Overwrite function, or another control code.
HP-UX reacts to certain control characters which might conflict with the modify codes. For example, control-D sends an end-of-file signal to HP-UX but is also the delete character in modify. You should use the HP-UX stty
program to change the default end-of-file signal. Please see the section Control Characters and stty for more details.
Erasing the Line
To erase from the current column to the end of the line, enter the Delete control code, followed by a Return. If you do this by mistake, the Goof control code restores the line for you.
Inserting Characters
To insert characters in the line before the current column position, enter the Before control code (Control-B). Then type the characters to be inserted. The existing characters starting in the insert column are right-shifted to make room for the new characters.
On the operator's console of Seried 800 compputers, the Control-B character puts the terminal into "maintenance" mode. In these cases, use Control-^ instead. If you do press Control-B on the console accidentally, type "CO" on a Series 800 or 900.
Adding Characters to the End of a Line
To add characters to the end of the line after the last nonblank character in the line, enter the Append control code (Control-A). Then type the characters to be added. This function is independent of the current column position.
Dividing a Line into Two Lines
The Divide control code (Control-V) splits the current line into two lines at the current column position. If a line number is available, Qedit moves all characters from the current column to the end of the line to a new line that is added after the current line. The Goof function recalls the original contents of the line, but does not delete the new line (neither does Control-Y). See also Divide command.
Splicing Two Lines Together
To splice two lines together, you must be on the first column of the first line you wish to splice. Type Control-T, then Control-V, and quick as a wink, all the characters from the second line are appended to the end of your current one. Qedit moves only as many characters as will fit. If all the characters are moved, the second line, now empty, is deleted. See also the Glue command.
Editing Lines with More Than 80 Columns
To modify long lines (i.e., more than 80 columns), use Set Left and Set Right to define a slice through the lines.
/set left 55
/mqt * {quiet, with template}
+....60...+....70...+....80...+....90...+....100..+....
ubsequent Sales Follow-up - Completion Ratio Report
Or use Set Modify Qzmodify, it handles long lines without the need to set margins.
Qzmodify: WYSIWYG
You may want to try Set Modify Qzmodify to replace the normal Qedit modify with a "visual" modify (What You See Is What You Get). Qzmodify uses the same Control codes, plus many extensions, but Qzmodify does single-character reads. This allows it to respond immediately and visually to each keystroke, but means that the performance is unacceptable over NS, packet-switching LANs, and the DTC. Once in Qzmodify, type Control-Q for a list of commands.
How to Edit in Qzmodify
In Qzmodify, "what you see is what you get". The cursor rests on the same line as the text you are editing. If you press any printable key (ASCII code 32 or greater), that key either replaces the character the cursor was on, or (if Insert mode is on) inserts the key before that character, moving the rest of line to the right by one character.
When you initially enter Qzmodify you are in Transparent mode--here, a blank simply causes the cursor to move one space to the right. Pressing any other printable character immediately terminates Transparent mode and puts you in Overwrite mode, so the character replaces the one the cursor is on. The three basic modes are:
Mode | To enter | To exit |
transparent | ^T | any printable char, ^B, ^O, or ^X |
overwrite | ^O | ^T, ^B, or ^X |
insert | ^B or ^^ | ^T, ^O, or ^X |
Qzmodify will not allow you to create a line longer than a maximum specified by the calling program, nor can you accidentally "lose" characters off the right edge when using Insert mode ... Qzmodify beeps when you try to do something illegal. To edit Roman-8 characters, use Set Editinput Extend ON.
Editing Commands
Qzmodify has an extensive set of commands, all of which are invoked via control characters. In this documentation, the symbol ^ means that the following character is a control character (e.g., ^G is control-G). Control characters may be entered as lowercase or uppercase letters (i.e: ^g and ^G are identical).
HP-UX reacts to certain control characters which might conflict with the Qzmodify codes. For example, control-D sends an end-of-file signal to HP-UX but is also the delete character in Qzmodify. You should use the HP-UX stty
program to change the default end-of-file signal. Please see the section Control Characters and stty for more details.
Char Mnemonic | Description |
^A append | Go to end-of-line. Moves the cursor to just after the last character on the line. If the line is already at the maximum length, the cursor is placed at the last character. |
^B before | Turn on Insert mode. Turns off Overwrite mode. If you enter a character while in Insert mode, it will be put Before the character the cursor is on, and the rest of the line will move one to the right. |
^^ before | Control up-arrow...synonym of ^B. Use ^^ instead of ^B if you are on a system console! |
^C case | Change case of current character. If the current character is a lowercase letter, it will be changed to an uppercase letter and vice versa. |
^D delete | Delete character. Pressing ^D will cause the character under the cursor to be deleted, and the rest of the line to be moved one space to the left. |
^L^D delete end | If the cursor is just past the last character in the line, (i.e., you just did a ^L or ^A), then the ^D will delete the last character of the line. |
^E erase | Erase to end of line. This will erase all of the text from the cursor to the end of the line. |
^F<c> find | Find next occurrence of character <c>. The cursor will be moved to the next occurrence of the character <c> to the right of the cursor. If <c> is not found, you will hear a beep. |
^F<n><c> | Find nth occurrence of <c> where 1<=n<=8. |
^G goof | Undo all current modifications. Restores the line of text to its original form. Note: ^V, ^K, ^T^D, and ^T^V cannot be undone. |
^H backspace | Move back one character (nondestructive). |
^I tab | Skip ahead to the next tab stop. |
^J justify | Deletes blanks from the cursor to the first nonblank (does not delete that character). |
^K add | Requests Qedit to add a line after the current line. The current line will then be redisplayed for editing and you will get to edit the new line. |
^L lengthen | Go to end-of-line...synonym of ^A. Use ^L instead of ^A if you are on a Type Ahead Engine (TAE). |
^M return | Marks the end of editing a line. Returns the modified line to Qedit. Note that ^M is the same as Return. |
^O overwrite | Initiates Overwrite mode and turns off Insert mode (^B). In Overwrite mode, if you enter a character, it will replace the one on the screen. |
^P<#><dir> | Moves up or down some number of lines of text. For example, ^P3- moves back three lines. |
^Q query | Displays list of Qzmodify functions. |
^S<c> scan | Find previous occurrence of <c>. The cursor will be moved to the first occurrence of <c> to the left of the current cursor position. If <c> is not found, you will hear a beep. |
^S<n><c> | Find nth occurrence of <c> where 1<=n<=8. |
^T Transparent | Terminates Insert mode and Overwrite mode. After ^T, if you type blanks, the cursor simply moves right one space without affecting the text. Transparent mode is always turned off automatically whenever a nonblank printable character is entered, then Overwrite mode is turned on. |
^T^D delete | If done at column one, this deletes the entire line. |
^T^V splice | If done at column one, this will join the next line to the end of the current line and display the spliced line for editing. If not a column one, then is the same as ^V. |
^U jUmpback | Move back to the previous tab stop. This is the opposite to ^I. As an aid to remembering them, ^I is the same as pressing the tab key, and ^U is just to the left of ^I on the keyboard. |
^V split | Split the current line (at the cursor) into two lines and modify both of them. Note that ^Y restores the text if you decide not to make the change, but you have to manually remove the second split-off line. |
^X eXamine | Examine (redisplay) the current line. |
^Y abort | Terminates modify without changing the current line. |
^W Wordproc | Shifts into "word-processor" mode. In word-processor mode, the next control character is used to select a function. The functions are: |
^W^C | Compress multiple blank spaces to single blank spaces. |
^W^D | Delete Word. Deletes from the cursor to the next blank, and then any following blanks up to (but not including) the next nonblank. |
^W^H | Toggles a flag that remembers if you have an HP 110 (or an HP 2640). The flag is needed because the HP 110 knows only a subset of the "standard" HP 26xx escape sequences, and some of them incorrectly! |
^W^L | Draws a ruled "line"; similar to the ListT command. |
^W^N | Toggles Numbered mode. A line-number prefix will be displayed in front of a line of text only if both of the following are true:- line numbers have been requested (either via a Modify command from Qedit or via ^W^N);- the line number was passed to Qzmodify by Qedit (i.e., you did an Modify command, not an ModifyQ command) |
^W<c>^D | Delete all characters from the cursor up to, but not including, character <c>. Note: <c> must be a printable ASCII character (character code > 31). If the cursor is currently on the same <c>, it is deleted immediately before looking for the first <c>. If <c> is not found, nothing is deleted. |
^W^P<c> | Put the character into the text. This is useful when you want to put a control character into the text. All nonprintable characters will be displayed as periods (.), so they will take up one space on the line. |
^W^S^D | Downshift all letters from the cursor to end-of-line. |
^W^S^U | Upshift all letters from the cursor to end-of-line. |
^W^S^T | Reverse the case (e.g., "a" becomes "A" and "A" becomes "a") of all letters from the cursor to end-of-line. |
^W^T | Toggles the Type Ahead Engine (if you have one) through three states: disabled, enabled, ignored. |
^W^V | Prints the version ID of Qzmodify. |
^W? | Display the ASCII character code for the character that the cursor is on. |
^W$<hh> | Replace the character at the current column position with the ASCII character whose hexadecimal value is <hh>. |
Symbols Used in Qzmodify Command List
<c> is any single character. Qzmodify will search for this character. If <c> is ^W, the search will be for the next word (words are anything delimited by blanks) instead of for a single character.
<#> is zero or more digits. For example, ^P12+ would mean move forward 12 lines. ^P3- would move back three lines.
<n> is one of: ^A, ^B, ..., ^H and is interpreted as the number 1, 2, ..., 8 respectively.
<dir> is a "-" to move "back", or a "+" to move "forward".
<hh> is any pair of hexadecimal digits.
Note: When modifying a line longer than 79 characters, some commands (e.g.: ^D, ^B, ^E) will not update any line of the screen display other than the one you are on. Whenever you want to see an accurate display of your text line, press ^X to refresh the display. This limitation could be fixed, but only at the cost of slowing down response time while editing these longer lines.
Note: You cannot use the special keys on an HP terminal (e.g.: cursor keys, insert char, delete char, clear) because they are designed to either send no characters to the computer when they are pressed or two characters ... and both of these choices cause difficult problems unless you are on an HP e3000 with a Type Ahead Engine. Thus, these keys should not be used. If you use them by accident, a ^X will refresh the display of the line you are editing.
Qzmodify with a Type Ahead Engine
The Type Ahead Engine (TAE) from Telamon can be in one of three states from the Qzmodify viewpoint: disabled, enabled, or ignored. Each is defined below.
Ignored. Qzmodify will not do anything to either encourage the use, or discourage the use, of the TAE. This is usually the initial state (see below).
Enabled. Qzmodify will place the TAE in single-character mode at entry, and restore it to Line mode at exit. This means that the HP3000 won't lose typed ahead input anymore, and that the special keys (e.g., cursor keys) will work nicely.
Disabled. Qzmodify will disable typeahead (by sending ^A^V to the TAE) at entry, and enable it at exit. In this mode, the TAE is effectively taken out of the "circuit".
With Qedit, you configure TAE-treatment as part of the Set Modify Qzmodify command:
Set Mod Qzmodify {ignore the TAE}
Set Mod Qzmod TAEOFF {TAE exists, disable it}
Set Mod Qzmod TAE {TAE exists, enable it}
When the TAE is present and enabled, you can use these extra commands:
^W^T | Toggles the Type Ahead Engine through three states: disabled, enabled, ignored. |
leftarrow | The HP26xx left-arrow key will move the cursor 1 space to the left. |
rightarrow | The HP26xx right-arrow key will move the cursor 1 space to the right. |
up arrow | Move up to the prior line of text, leaving cursor in the same column. The terminal screen is scrolled DOWN, so the line you were just editing is moved down 1. |
down arrow | Move down to the next line of text, leaving cursor in the same column. The terminal screen is scrolled UP, so the line you were just editing is moved up 1. |
delete char | Deletes the character under the cursor (like ^D). |
insert char | Turns on Insert mode (like ^B). |
insert line | Asks Qedit to add a new line after the current line. |
delete line | Asks Qedit to delete the current line. |
^leftarrow | Moves cursor LEFT to the blank just after the nearest "word" on the left of the cursor. Valid only if a Type Ahead Engine is present and enabled. Only available on HP264x terminals. |
^rightarrow | Moves cursor RIGHT until it reaches the start of the next "word" (will not move past current end of text.) Valid only if a Type Ahead Engine is present and enabled. Only available on HP264x terminals. |
Hpmodify: No Control Characters
Set Modify Hpmodify replaces Qedit's standard Modify in all places with MPE-style editing (D for delete, I for insert, R for replace, U for undo, > for append, >D for delete at end, >R for replace at end, and D> for clear). We suggest Hpmodify when using Qedit over finicky datacomm networks, since it does not require any Control codes.
Hpmodify Keys - Reference
Directive | Effect |
i | INSERT. If text follows the i, this text is inserted in the current line, starting at the position of the i. |
r | REPLACE. If text follows the r, this text replaces the same number of characters in the current line, beginning at the position of the r. |
d | DELETE. Deletes a character from the current line for each d specified in the edit line. Note that "d d" does not specify a range as it does in MPE V but simply deletes one character above each d. Multiple d's may be followed by an Insert or Replace operation. |
d> | DELETE. Deletes to the end of the current line from the position specified by d>. May be followed by an Insert or Replace operation. |
> | APPEND. If text follows the >, this text is appended to the end of the current line. If a > without text is positioned beyond the end of the current line, then a simple replacement is performed instead. |
>d | DELETE. Deletes from the end of the current line, right-to-left. Multiple d's and Insert and Replace strings may be specified after > . |
>r | REPLACE. Replaces characters at the end of the command line. The last (rightmost) character of the replacement string is at the end of the line. |
c | CHANGE. Changes all occurrences of one string to another in the current line starting at the c. The search string and replace string must be properly delimited. A proper delimiter is a nonalphabetic character (such as ' " or /) The substitution is specified as cdelim search-string delim [replace-string [delim]]. Omitting the replace-string causes occurrences of search-string to be deleted, with no substitution. |
u | UNDO. A single u in column one cancels the most recent edit of the current line. Using the Undo command twice in a row cancels all edits for the current line and re-establishes the original, unedited line. If u is placed anywhere other than column one of the current line, then a simple replacement is performed. Undo makes sense only if you have a line on which you have performed some editing that can be "undone." |
other | Simple replacement. Any other character (not i, r, d, d>, >, >d, >r, c, or u) will be put into the current line at the position above where it is placed, replacing any existing character. Simple replacement also occurs for the editing characters i, r, c, or > if they are not followed by text; or if > appears at or beyond the current end of line. |
Hpmodify Examples
Edit | Action |
u | First occurrence undoes the previous edits. The u must be in column one. |
u | Second occurrence undoes all edits on the current line. The u must be in column one. |
rxyz | Replaces the current text with xyz starting at the position of r. |
xyz | Replaces the current text with xyz starting at the position of x. |
ixyz | Inserts xyz into the current line, starting at the position of the i. |
ddd | Deletes three characters, one above each d. |
d xyz | Deletes a single character above the d, skips one space, then replaces the current text with xyz starting at the position of x. |
ddixy | Deletes two characters, then inserts xyz in the current line starting at the position of the i. |
d d | Deletes one character above the first d, skips two spaces and deletes a second character above the second d. It does not delete a range of characters, making it unlike the MPE V version of Redo. |
d d>xyz | Deletes a single character above the first d, skips two spaces and deletes to the end of the line beginning at the second d, and then places xyz at the end of line. |
>xyz | Appends xyz to the end of the current line. |
>ddxyz | Deletes the last two characters from the end of the current line and then places xyz at the end of the line. |
>rxyz | Replaces the last three characters in the current line with xyz. |
>ixyz | Appends xyz to the end of the line. In this case, the i command is superfluous, because > accomplishes the same result. Using >xyz would be sufficient. |
c/ab/def | Changes all occurrences of ab to def, starting at c. |
c"ab" | Deletes all occurrences of "ab" starting at c. |
cxyz | Replace the current text with cxyz, starting at c. Because delimiters have not been specified (as they were in the previous two examples), this is a simple replacement with the four characters. |