DE - Delete

Deletes lines from an item. String deletion is not supported; to delete a string from within a line, use the R (Replace) command.

Syntax

DE{n}{/string{/p{-q}}}
or
DEm-k{/string{/p{-q}}}
or
DEm,n{/string{/p{-q}}}

Syntax Elements

n The number of lines to process, beginning with the current line. If n is omitted, it defaults to the current line (but see string below).

m -kSpecifies line m through line k.

m ,nSpecifies n lines, starting at line m.

/ A delimiter separating the syntax elements. It can be any nonnumeric character (except a blank or minus sign) that does not appear in string. The following characters have special meanings when used as delimiters:

# (hash) Negates the search; deletes lines that do not contain the specified string(s).

: (colon) Anchors the search to the starting column (see Column Dependent Matching).

string A search string. Only lines containing this string will be deleted (but see the p and q parameters below). Lines that are deleted are listed and the line pointer is positioned at the last line in the specified range.

Note that, if no lines are specified, the next line containing string is located and that line is deleted.

The caret character (^) can be used within the search string to match any single character (see Wildcard Character for more details).

p Specifies a starting column (see Column Dependent Matching).

q Specifies an ending column. If omitted, defaults to p. Ignored if less than p.

Example 1

:ED TEST IT1
Top
.L99
001 123XYZ
002 AAAAAAA
003 XYZ123
004 ABABABAB
005 12345
006 AA
EOI 006
.G5
005 12345
.DE2
.F
Top
.L99
001 123XYZ
002 AAAAAAA
003 XYZ123
004 ABABABAB
EOI 004
.T
Top
.DE99/123/
001 123XYZ
003 XYZ123
EOI 004
.F
Top
.L99
001 AAAAAAA
002 ABABABAB
EOI 002
.DE2:^B:
002 ABABABAB
EOI 002
.F
Top
.L99
001 AAAAAAA
EOI 001
.FI
'IT1' filed in file 'TEST'.




Contents of item IT1.






Go to line 5.

Delete 2 lines.
F command toggles buffers.


Contents of item IT1 after lines 5 and 6 were deleted.






Delete all lines that contain the string "123".



F command toggles buffers.


Contents of item IT1 after deletion of lines containing "123".


Delete next two lines with "B" in column 2.


F command toggles buffers.


Contents of item IT1 after deletion of lines containing "B" in column 2.

Example 2

:ED CUSTOMER T4
Top
.P
001 AAAA
002 BBCBB
003 CCCCB
004 DDDD
EOI 004
.T
Top
.DE/CB
002 BBCBB
.X
L 2
.T
Top
.DE2/CB
002 BBCBB
.Return
003 CCCCB




Contents of item called T4.






Delete the next line containing the character string 'CB'.
Undo that edit.




Delete any of the next 2 lines (1 and 2) that contain the character string 'CB'. Line 3 is unaffected.

Example 3

:ED CUSTOMER T4
Top
.P
001 AAAA
002 BBCBB
003 CCCCB
004 DDDD
EOI 004
.T
Top
.DE2-3/CB/
002 BBCBB
003 CCCCB
.FS
Top
.P
001 AAAA
002 DDDD
EOI 002
.FI




The original, unedited item called T4.






Delete any line found within lines 2 and 3 that contains the character string 'CB'.




Lines 2 and 3 both contained the character string 'CB', and both were deleted.