# man > GREPDIFF(1)

[GREPDIFF(1)](https://www.chedong.com/phpMan.php/man/GREPDIFF/1/markdown)                                   Man pages                                  [GREPDIFF(1)](https://www.chedong.com/phpMan.php/man/GREPDIFF/1/markdown)



## NAME
       grepdiff - show files modified by a diff containing a regex

## SYNOPSIS
       **grepdiff** [[-n] | [--line-number]] [[-N] | [--number-files]] [[-p _n_] | [--strip-match=_n_]]
                [--strip=_n_] [--addprefix=_PREFIX_] [--addoldprefix=_PREFIX_] [--addnewprefix=_PREFIX_]
                [[-s] | [--status]] [[-i _PATTERN_] | [--include=_PATTERN_]] [[-I _FILE_] |
                [--include-from-file=_FILE_]] [[-x _PATTERN_] | [--exclude=_PATTERN_]] [[-X _FILE_] |
                [--exclude-from-file=_FILE_]] [[-# _RANGE_] | [--hunks=_RANGE_]] [--lines=_RANGE_]
                [[-F_RANGE_] | [--files=_RANGE_]] [--annotate] [--as-numbered-lines=_WHEN_]
                [--format=_FORMAT_] [--remove-timestamps] [[-v] | [--verbose]] [[-z] | [--decompress]]
                [[-E] | [--extended-regexp]] [[-H] | [--with-filename]] [[-h] | [--no-filename]]
                [--output-matching=_WHAT_] [--only-match=_WHAT_] {[_REGEX_] | [-f _FILE_]} [_file_...]

       **grepdiff** {[--help] | [--version] | [--list] | [--filter ...]}

## DESCRIPTION
       For each file modified by a patch, if the patch hunk contains the _REGEX_ then the file's name
       is printed.

       The regular expression is treated as POSIX Basic Regular Expression syntax, unless the **-E**
       option is given in which case POSIX Extended Regular Expression syntax is used.

       For example, to see the patches in my.patch which contain the regular expression
       “pf_gfp_mask”, use:

           grepdiff pf_gfp_mask my.patch | \
             xargs -rn1 filterdiff my.patch -i

       You can use both unified and context format diffs with this program.

## OPTIONS
### -n --line-number
           Display the line number that each patch begins at. If verbose output is requested, each
           matching hunk is listed as well.

           For a description of the output format see [**lsdiff**(1)](https://www.chedong.com/phpMan.php/man/lsdiff/1/markdown).

### -N --number-files
           File numbers are listed, beginning at 1, before each filename.

### -p --strip-match=
           When matching, ignore the first _n_ components of the pathname.

       **--strip**=_n_
           Remove the first _n_ components of the pathname before displaying it.

       **--addprefix**=_PREFIX_
           Prefix the pathname with _PREFIX_ before displaying it. This will override any individual
           settings specified with the **--addoldprefix** or **--addnewprefix** options.

       **--addoldprefix**=_PREFIX_
           Prefix pathnames for old or original files in the output by _PREFIX_.

       **--addnewprefix**=_PREFIX_
           Prefix pathnames for updated or new files in the output by _PREFIX_.

### -s
           Show file additions, modifications and removals. A file addition is indicated by a “+”, a
           removal by a “-”, and a modification by a “!”.

### -i --include=
           Include only files matching _PATTERN_.

### -I --include-from-file=
           Include only files matching any pattern listed in _FILE_, one pattern per line. All other
           lines in the input are suppressed.

### -x --exclude=
           Exclude files matching _PATTERN_.

### -X --exclude-from-file=
           Exclude files matching any pattern listed in _FILE_, one pattern per line. All other lines
           in the input are displayed.

       **-#** _RANGE_, **--hunks**=_RANGE_
           Only include hunks within the specified _RANGE_. Hunks are numbered from 1, and the range
           is a comma-separated list of numbers or “first-last” spans, optionally preceded by a
           modifier 'x' which inverts the entire range; either the first or the last in the span may
           be omitted to indicate no limit in that direction.

       **--lines**=_RANGE_
           Only list hunks that contain lines from the original file that lie within the specified
           _RANGE_. Lines are numbered from 1, and the range is a comma-separated list of numbers or
           “first-last” spans, optionally preceded by a modifier 'x' which inverts the entire range;
           either the first or the last in the span may be omitted to indicate no limit in that
           direction.

### -F --files
           Only list files indicated by the specified _RANGE_. Files are numbered from 1 in the order
           they appear in the patch input, and the range is a comma-separated list of numbers or
           “first-last” spans, optionally preceded by a modifier 'x' which inverts the entire range;
           either the first or the last in the span may be omitted to indicate no limit in that
           direction.

### --annotate
           Annotate each hunk with the filename and hunk number.

       **--as-numbered-lines**=before|after
           Instead of a patch fragment, display the lines of the selected hunks with the line number
           of the file before (or after) the patch is applied, followed by a TAB character and a
           colon, at the beginning of each line. Each hunk except the first will have a line
           consisting of “...”  before it.

       **--format**=unified|context
           Use specified output format.

### --remove-timestamps
           Do not include file timestamps in the output.

### -z --decompress
           Decompress files with extensions .gz and .bz2.

### -E --extended-regexp
           Use POSIX Extended Regular Expression syntax.

### -H --with-filename
           Print the name of the patch file containing each match.

### -h --no-filename
           Suppress the name of the patch file containing each match.

### -f --file=
           Read regular expressions from _FILE_, one per line.

       **--output-matching**=hunk|file
           Display the matching hunk-level or file-level diffs.

       **--only-match**=rem|removals|add|additions|mod|modifications|all
           Limit regex matching to removals, additions, modifications or the whole hunk.

### --help
           Display a short usage message.

### --version
           Display the version number of grepdiff.

### --filter
           Behave like [**filterdiff**(1)](https://www.chedong.com/phpMan.php/man/filterdiff/1/markdown) instead.

### --list
           Behave like [**lsdiff**(1)](https://www.chedong.com/phpMan.php/man/lsdiff/1/markdown) instead.

## SEE ALSO
       [**filterdiff**(1)](https://www.chedong.com/phpMan.php/man/filterdiff/1/markdown), [**lsdiff**(1)](https://www.chedong.com/phpMan.php/man/lsdiff/1/markdown), [**patchview**(1)](https://www.chedong.com/phpMan.php/man/patchview/1/markdown)

## AUTHOR
       **Tim** **Waugh** <<twaugh@redhat.com>>
           Package maintainer



patchutils                                   10 Feb 2011                                 [GREPDIFF(1)](https://www.chedong.com/phpMan.php/man/GREPDIFF/1/markdown)
