Option 'O' --> Output Context Lines Before/After Match. Normally QTGrep only outputs the line matched. However, sometimes it is desirable to view the matched lines within the context of the lines before and after the matched line. This option turns on and off or sets the number of lines
output before and after the matched line. The format of this option is:

-O+ --> turns on outputting context lines before and after the matched
        line. Uses the value for the number of lines as set in the
        configuration file.
-O- --> turns off outputting of context lines before and after the matched
        line.

-Onn
or
-O(nn)
or
-O nn
   --> this form turns on outputting context lines before and after the
       match line and sets the number of lines output to 'nn'

Note that when context lines are output before and/or after matched lines, the context lines are distingished from the matched lines by prefixing
each context line with a single hyphen, '-', and prefixing each match line with a single colon, ':'. Thus the output for context lines
following a match line is:

-This line is the first context line before
-This line is the second context line before
:This line matched an input expression
-This line is the first context line following
-This line is the second context line following

Note that if expression numbers are also output, the expression number is output as a field of asterics, '*', for context lines.

Note that if line/record numbers are also output, the record number of the context line is output also. As mentioned above, the record number
specifier, 'R' (or 'b' for backward searches), is followed by a hyphen, '-', for context lines and by a colon, ':', for match lines.

Thus if record number are output, the output would resemble:
   343R-This line is the first context line before
   344R-This line is the second context line before
   345R:This line matched an input expression
   346R-This line is the first context line following
   347R-This line is the second context line following

NOTE: if the number of lines output before or after a match is also set with the 'Y' or 'A' options, then the numeric values set with those options overrides any value set with this option.

See Also: -?A and -?Y

This is a local option and may be turned on or off for separate files as desired.

The corresponding long option is: --context-lines=[on|off|NUM]

If context lines are turned on with the long option:

--context-lines=on

Then the number of context lines specified in the configuration file is utilized. If no value was specified in the configuration file, then the
default value of 5 is utilized.

 This is a local option and may be turned on or off for separate files as desired.

Incompatible Options Are:
W
Write Compiled Search Patterns
c
Count of Matches Only
r
Match Replacement
y
Ignore Records
z
Simulate Match Replacement


© Terry D. Boldt 1997-2005
All Rights Reserved
Last Updated: Nov. 24, 2005