# xgrep(3)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

xgrep - Execute grep command
rgrep - Execute recursive grep command

## SYNOPSIS

xgrep "expression files..." rgrep "expression" "base-path" "file-mask"

## DESCRIPTION

xgrep executes the grep(1) command with the command line set by the %xgrep-com(5) variable and the user supplied expression and file list files.... The output of the command is piped into the *grep* buffer ready for the get-next-line(2) command to step through all matched lines. The syntax from the grep output must be setup using add-next-line(2).

If an argument is given then a pipe-shell-command(2) is used instead of ipipe-shell-command(2), this is useful when used in macros as it ensures that grep has finished before the command returns.

rgrep is similar to grep in that it uses grep(1) to search for all occurrences of expression, but rgrep also uses find(1) to search for expression in all files matching the file-mask in all directories from base-path down.

## NOTES

xgrep is a macro defined in `xfind.emf`.

grep(1) must be executable on the system before grep or rgrep can function, find(1) must also be available for rgrep to work. The find(1) command is defined by variable %xfind-com(5), the default when not defined is `find`.

## EXAMPLE

The xgrep command is generally set up in the startup files as follows:-

    ;
    ; setup the next-error stuff including grep and compiling
    ;
    set-variable $line-template "[0-9]+"
    set-variable $file-template "[a-zA-Z:]*[0-9a-zA-Z\_.]+"
    ;
    ; Definitions for GNU grep utility.
    ;
    set-variable %xgrep-com "grep -n "
    0 add-next-line "*grep*"
    add-next-line "*grep*" "%f:%l:"

## SEE ALSO

%xfind-com(5), %xgrep-com(5), add-next-line(2), compile(3). find(1), xfind(3), get-next-line(2), grep(1).

(c) Copyright JASSPA 2009
Last Modified: 2009/08/31
Generated On: 2009/10/12

</HMTL>