DELETE - Delete Selected Lines
Syntax
DELETE |
DUP [ line-control-range ] |
DELETE |
{ NOTE | xNOTE | ZNOTE } [ line-control-range ] |
DELETE |
[ string [ PREFIX | SUFFIX | WORD | CHAR ] ] [ C ] [ Q ] [ T ] [ start-column [ end-column ] ] [ line-control-range ] [ color-selection-criteria ] [ ALL | FIRST | LAST | NEXT | PREV ] [ TOP ] |
Operands
There are three basic modes of DELETE operation. DEL DUP is single purposed to delete adjacent duplicate lines. DEL NOTE is used to delete NOTE lines within a specified range while the third provides a more general use delete function that can delete data lines that match a wide range of matching capabilities.
Note that DELETE DUP and DELETE NOTE do not permit other DELETE keywords to be used. In particular, you cannot issue a command like DELETE DUP ALL or DELETE NOTE ALL. Within the specified line-control range, or within the entire edit file, all duplicates or all notes are deleted; the "ALL" is implied but cannot be used on these commands.
Note: If you want to use DUP or NOTE as normal search strings they must be enclosed in quotes.
DUP |
Specifies this command is to delete adjacent duplicate lines from the line range. When determining if two lines are duplicates of each other, SPFLite checks that they are of identical length and are byte-for-byte identical for the entire length of the lines, including any leading and trailing blanks that may exist. |
||
NOTE xNOTE ZNOTE |
NOTE specifies this command is to delete all =NOTE> lines from the line range.
xNOTE specifies this command is to delete all extended xNOTE> lines from the line range, where 'x' is any letter from A to Y. To delete all extended notes of type A, issue DELETE ANOTE. ZNOTE specifies this command is to delete all extended xNOTE> lines of all types from the line range, where 'x' is any letter from A to Y. DELETE ZNOTE will not delete "plain" =NOTE> lines. The keyword NOTE and the forms ANOTE through ZNOTE are reserved. NOTE may not be specified as NOTES. |
||
string |
If string is present, a string-based delete is requested; only lines containing string are eligible for deletion within the selected line range. The default for string searches is NEXT. Note that a “string-based delete” means the entire line having the string is deleted; it does not mean to delete the string alone from the line. The string may be unquoted, or simply quoted, or may be any of the standard string types C, T, X, P or R. If string is omitted, a line-based delete is requested; lines within the selected line range are deleted. If neither ALL, FIRST, LAST, PREV or NEXT is specified on a non-string-based DELETE, ALL is assumed. |
||
CHARS | WORD | PREFIX | SUFFIX |
These options are allowed only for string-based deletes; they describe the “string context” in the same way that a FIND or CHANGE command does. If omitted for a string-based delete, the string will be searched for in WORD mode if C W or T W appears in the middle of the status line, and in CHARS mode if C or W appears in the middle of the status line. WORD mode or CHARS mode can be set by FIND WORD or FIND CHARS, respectively. |
||
|
|
||
ALL |
For line-based deletes, ALL is allowed mainly for compatibility with prior releases. ALL is assumed if not specified, except for string-based deletes which assume NEXT. Note that to delete the entire file, DELETE ALL is permitted. When deleting the entire file, the command DELETE must be fully spelled out and cannot be abbreviated as DEL, and the ALL keyword is not assumed but must be explicitly specified. These rules help prevent accidental deletion of the file. A lone DELETE with no other options is illegal. |
||
line-control-range |
The range of lines which are to be processed by the command. The full syntax and allowable operands which make up a line control range are discussed in "Line Control Range Specification". |
||
|
Left column of a range (with end-column) within which the search-string value must be found. If no end-column operand, then the search-string operand must be found starting in start-col. |
||
end-column |
Right column of a range (with start-column) within which the search-string value must be found. |
||
color-selection-criteria |
A request for selection based on the highlight color of the search-string. The full syntax and allowable operands which make up a color-selection-criteria are discussed in "Color Selection Criteria Specification". |
||
FIRST or NEXT |
Starts at the top of the specified range and searches ahead to find the first occurrence in the specified line-control-range and delete that line. NEXT is assumed for string based deletes. |
||
LAST or PREV |
Starts at the bottom of the specified range and searches backward to find the last occurrence in the specified line-control-range and delete that line. |
||
TOP |
|
Abbreviations and Aliases
DELETE can also be spelled as DEL
PREFIX can also be spelled as PRE or PFX
SUFFIX can also be spelled as SUF or SFX
WORDS can also be spelled as WORD
CHARS can also be spelled as CHAR
Description
DELETE removes lines from an edit session.
Specifying the Data to Delete
Two methods of specifying the data are possible.
- The first is the classic ISPF method of specifying line numbers as operands to the DELETE command. You have the full range of options allowed by SPFLite's extended line-control-range operands.
- Or, the lines may be marked by C/CC line commands.
Note carefully:
- When issuing a DELETE ALL command, you must fully spell out the command name DELETE. If you try to specify DEL ALL, the command will be rejected. Since most users, by habit, type the shortest command they can, this provides a degree of protection against typing this command by mistake.
- Depending on whether the X or NX operands are specified, the data deleted will be the entire contents of the specified line range if these operands are omitted, or the specified subset (X or NX) if the operands are specified.
- When performing a string-based delete, the options ALL, FIRST, LAST, PREV and NEXT are all available.
Repeatable DELETE
Just as FIND and CHANGE can be selectively repeated using RFIND (or RLOCFIND) and RCHANGE, so can the string-based version of DELETE. You can issue a command like DELETE 'ABC' and use RFIND/RCHANGE to selectively find and delete lines.
RFIND, RLOCFIND and RCHANGE now have support to allow this action to be performed following an initial DELETE command, when the DELETE has a find-string operand. As a reminder, RFIND (or RLOCFIND) is typically mapped to the F5 key, and RCHANGE to the F6 key.
For example, if you place DELETE 'ABC' on the command line, then press F5 instead of Enter, DELETE will locate the next line containing ABC, but will not delete it. To actually "follow through" and delete that line, press F6. If you don't want to delete that line, you can press F5 to find the next line with ABC, or simply do something else.
Other examples of the DELETE command
To delete all excluded lines:
DELETE X
or
DELETE ALL X
To delete all non-excluded lines:
DELETE NX
or
DELETE ALL NX
To delete a range of lines using line numbers:
DELETE 20 30
or
DELETE ALL 20 30
To delete a range of lines using line labels:
DELETE .HERE .THERE
or
DELETE ALL .HERE .THERE
To delete only excluded lines within a range of lines using line numbers:
DELETE X 25 35
or
DELETE ALL X 25 35
To delete lines tagged with an :AB line tag:
DELETE :AB
or
DELETE ALL :AB
To delete all lines containing the “ABC”:
DELETE ALL ABC
To delete all lines containing the “DEF” highlighted in RED:
DELETE ALL "DEF" RED
To delete all unexcluded lines containing the text “abc” as a prefix:
DELETE ALL T'abc' PREFIX NX
Note: DELETE cannot be used to delete zero-length blank lines based on a string. See NDELETE for an example of how to do this.