NFIND - Find Where String is Not Found
Syntax
NFIND |
search-string [ start-column [ end-column ] ] [ FIRST | LAST | NEXT | PREV | ALL ] [ PREFIX | SUFFIX | WORD | CHAR ] [ line-control-range ] [ X | NX ] [ U | NU ] [ MX | DX ] [ TOP ] |
Operands
search-string |
The search string that identifies the lines to skipped over, the search will be satisfied by the line which does not contain this string. |
|
start-column |
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. |
|
FIRST |
Starts at the top of the data and searches ahead to find the first line which does not contain the search-string. |
|
LAST |
Starts at the bottom of the data and searches backward to find the first line which does not contain the search-string. |
|
NEXT |
Starts at the first position after the current cursor location and searches ahead to find the first line which does not contain the search-string. NEXT is the default. |
|
PREV |
Starts at the current cursor location and searches backward to find the first line which does not contain the search-string. |
|
ALL |
Starts at the top of the data and searches ahead to find all lines which do not contain the search-string. |
|
PREFIX |
Locates search-string at the beginning of a word. |
|
WORD |
Locates search-string when it is delimited on both sides by blanks or other non-alphanumeric characters. |
|
CHAR |
Locates search-string regardless of what precedes or follows it. |
|
SUFFIX |
Locates search-string at the end of a word. |
|
line-control-range |
The range of lines which are to be processed by the command. Line control ranges provide a powerful tool to customize the range of lines to be processed. The full syntax and allowable operands which make up a line control range are discussed in "Line Control Range Specification". Refer to that section of the documentation for details. |
|
X | NX |
Specifies a subset of the line range to be processed. X requests only excluded lines are to be examined, NX requests only non-excluded lines are to be examined. If neither X or NX are specified, all lines in the range will be examined. |
|
U | NU |
Specifies a subset of the line range to be examined. U requests only User lines are to be examined, NU requests only non-User lines are to be examined. If neither U or NU are specified, all lines in the range will be examined. |
|
MX |
MX requests that all lines which do contain search-string be excluded from the display following command processing. MX = Make Excluded. |
|
DX |
DX requests that lines which do contain search-string, which, if excluded, would normally be made visible, be left in their excluded status. DX = Don't alter Excluded status. |
|
TOP |
|
Abbreviations and Aliases
NFIND can also be spelled as NF
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
You can use the NFIND command to locate line(s) within the file which do not contain a specified string.
To find the next line which does not contain the letters ELSE without specifying any other qualifications:
On the Command line, type:
NFIND ELSE
Press Enter. Since no other qualifications were specified, the letters ELSE can be:
- Uppercase or a mixture of uppercase and lowercase (assuming that CASE T is in effect)
- At the beginning of a word (prefix), the end of a word (suffix), or the entire word (word).
- In either an excluded or a non excluded line.
- Anywhere within the current boundaries.
To find the next line which does not contain the letters ELSE, but only if the letters are uppercase:
On the Command line, type:
NFIND C'ELSE'
Press Enter.
This type of search is called a character string search (note the C that precedes the search string) because it finds the next occurrence of the letters ELSE only if the letters are in uppercase. However, since no other qualifications were specified, the letters can be found anywhere in the file, as outlined in the preceding list.
For more information, including other types of search strings, see Finding and Changing Data and Specifying a Picture or Format String.
NOTE: When the NFIND search operand is a Regular Expression string, certain search operands are restricted. See Specifying A Picture String for more information.
Finding all-blank lines with NFIND
It is not possible to use FIND to find all blank lines. The reason is that a "blank" might have a variable number of space characters, or in a zero-length line there are no space characters at all. So, there is no specific string you could "search" for that would always be there. SPFLite's string search engine cannot find strings of zero length, because there is literally nothing to find.
The easiest way to find blank lines is to use NFIND instead of FIND. Instead of trying to find "blank" lines, you find all lines which are not non-blank lines.
People sometimes have issues with this, since it's like a "double negative", and not intuitive. Once you observe it in action, you'll see that it makes sense.
You can find non-blank lines by finding lines that contain P'^' or P'¬', which match non-blank characters. So, to find all blank lines, you find all lines which don't contain any non-blanks, like this:
NFIND P'^' ALL
Be sure to specify NFIND and not FIND. If you say FIND P'^' ALL, you will find every line in the file that is not blank.
If you dont' care for the "double negative" appearance of this command, you can define a SET variable that's easier to remember. Let's say we call this variable FBLANK. You define it like this (the outer quotes are required):
SET FBLANK = "NFIND P'^'"
Then when you want to find all blank lines, you would do it like this:
=FBLANK ALL
You can create a command alias so that the leading = sign is not needed. To do this, define the FBLANK command like this:
SET ALIAS.FBLANK = "NFIND P'^'"
Then when you want to exclude all blank lines, you would do it like this:
FBLANK ALL
Created with the Personal Edition of HelpNDoc: Keep Your PDFs Safe from Unauthorized Access with These Security Measures