Lines, Strings and Ranges
Character strings can be used of line numbers to qualify lines on most commands. In its simplest form, a command can have a single string using all the search window defaults.
/List "enhancement"
The search string can be further qualified using temporary window settings as in:
/List "enhancement" (Upshift 20/50)
This example searches for the word enhancement
regardless of the case used in columns 20 to 50.
Qedit allows up to 10 search strings on a single command. Individual strings are separated from each other with the OR keyword. Each string can have its own temporary window.
/List "enhancement" (U 20/50) or "bug" or "customer" (1/30)
The search range can be different depending on the command it is used on. For example, a List command searches all the lines in the file by default while a Find command starts from the current line. The search range can be specified on individual commands using a rangelist. A rangelist is often specified using line numbers (absolute or relative), special keywords (First, Last, All) or characters (@, *, [, ]). To define a block of lines, the user can enter 2 line numbers separated a slash "/" e.g. 1/6.
It is also possible to define a block of lines using a string range. This syntax allows the use of strings to define the start and end of the range. A string range can also be combined with a numeric line range to further define the block. Here are some examples:
/List "start-proc" / "end-proc"
/Change "a" "b" "start-proc" / "end-proc"
/Delete "start-proc" / "end-proc" 20/100
The List command above finds the first occurrence of start-proc
in the file and uses it as the range start location. It then finds the first occurrence of end-proc
starting from the start location. It uses that line as the range end location. Finally, it lists all the lines between the 2 locations. By default, List starts at the beginning of the file.
The Change command above replaces all occurrences of the letter a
with a b
in the lines between (and including) start-proc
and end-proc
. By default, Change starts at the current line.
The Delete command above removes all the lines between (and including) start-proc
and end-proc
found in lines 20 to 100. By default, Delete starts at the beginning of the file.
A string range does not behave like a rangelist e.g. 1/20 in all cases. For example, the first statement is not a valid construct with the second statement is.
/Delete "bug" "start-proc"/"end-proc"
Error: Linenum
/Delete "bug" 10/30
You can use the Find command and the ZZ marker to work around the problem. If you enter a simple strings on a Find command, Qedit stops at the first string occurrence and sets the current line. You can then perform any operation on that line or use it as a starting point. If you specify a line range, the Find command sets the ZZ marker to the block of lines. You then use the ZZ marker on subsequent commands.
/F "start-proc" first
5 Start-Procedure.
(1)^
/F "start-proc"/"end-proc" first
Lines 5/11 saved in ZZ
/Delete "bug" zz
8 _bug-display-section.
1 line Deleted!
![Home](rnd2hm_s.gif)
![Previous](rnd2pr_s.gif)
![Next](rnd2nx_s.gif)