%grep-com - Grep command line
%grep-com "string"; Default is "grep "
Sets the command line used to execute a grep(1) system command. The output of the grep(3) execution should include both file and line number information so that the command get-next-line(2) can be used properly. This is not defined by default and the grep command will not execute until it is defined.
grep(1) is typically used with the -n option which produced line numbering information which drives the get-next-line(2) command.
The following example shows how the grep strings are defined.
set-variable %grep-com "grep -n " add-next-line "*grep*" "" add-next-line "*grep*" "%f:%l:"
This definition corresponds to a grep output such as:-
m5var000.5:13:Sets the number of seconds to wait m5var000.5:14:temporary file to t seconds. A m5var000.5:15:Note than the temporary m5var000.5:17:saving a buffer. Backup files are m5var000.5:24:On unlimited length file name systems
where grep produces file and line number information for every match.
Use add-next-line(2) to define the line pattern produced by grep. Some versions of grep place the file name on a single line matches within the file occur on subsequent lines. In this case additional add-next-line patterns may be defined to cater for the grep output as follows:
set-variable %grep-com "grep /n " add-next-line "*grep*" "" add-next-line "*grep*" "File: %f:" add-next-line "*grep*" "%l:"
This definition would be used with a grep output such as:-
File:m5var000.5: 13:Sets the number of seconds to wait 14:temporary file to t seconds. A 15:Note than the temporary 17:saving a buffer. Backup files are 24:On unlimited length file name systems File:m5var001.5:
grep(1) is a standard utility on UNIX systems. For Windows 95/NT a version of GNU grep may be found at:
<ftp.winsite.com/ftp/pub/pc/winnt/misc/gnugrep.zip>
For MS-DOS users, a DJGPP port of grep is also available on the net. A commercial version of grep is also available from MKS.
add-next-line(2), grep(1), grep(3), add-next-line(2).
(c) Copyright JASSPA 1999
Last Modified: 1998/07/28
Generated On: 1999/12/01