L - Locate
Searches for and lists lines containing one or more specified character strings.
Syntax
L{n}/string[{ /& /string}...}|{ /! /string}...}]{/p{-q}}
or
Lm-k/string[{ /& /string}...}|{
/! /string}...}]{/p{-q}}
or
Lm,n/string[{ /& /string}...}|{
/! /string}...}]{/p{-q}}
or
/string[{ /& /string}...}|{
/! /string}...}]{/p{-q}}
Syntax Elements
n The number of lines to search, starting with the current line plus one.
m-k Specifies lines m through k.
m,n Specifies n lines, starting at line m.
/ A delimiter separating the different parts of the command. It can be any nonnumeric character (except a blank, minus sign or open parenthesis) that does not appear in the string. The following characters have special meanings when used as delimiters:
# (hash) Negates the search; finds lines that do not contain the specified string(s).
: (colon) Anchors the search to the starting column (see Column Dependent Matching).
The delimiter terminating the search string is necessary only if further parameters follow the string specification, or if trailing blanks are to be included as part of the string.
string The character string to be found.
The caret character (^) can be used within the search string to match any single character (see Wildcard Character for more details).
& Specifies AND: all strings combined using & must be present to select a line.
! Specifies OR: any string of those combined using ! causes selection of a line.
Note
You cannot use both & and ! in the same L command.
p Specifies a starting column (see Column Dependent Matching).
q Specifies an ending column. If omitted, defaults to p. Ignored if less than p,
Operation
If you do not specify a number or range of lines, the item is searched starting at the next line. The first line containing the search string (or the required combination of strings) is listed and the line pointer is set to this line.
If you specify a number or range of lines, all lines in which the search string was found are listed. Note that the line pointer is positioned at the last line in the specified range, and therefore might not be located at the last line listed.
Example
The following example shows some of the different ways in which the L(ocate) command can be used.
|
|