{
    "mode": "man",
    "parameter": "grepdiff",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/grepdiff/1/json",
    "generated": "2026-06-15T19:54:56Z",
    "synopsis": "grepdiff [[-n] | [--line-number]] [[-N] | [--number-files]] [[-p n] | [--strip-match=n]]\n[--strip=n] [--addprefix=PREFIX] [--addoldprefix=PREFIX] [--addnewprefix=PREFIX]\n[[-s] | [--status]] [[-i PATTERN] | [--include=PATTERN]] [[-I FILE] |\n[--include-from-file=FILE]] [[-x PATTERN] | [--exclude=PATTERN]] [[-X FILE] |\n[--exclude-from-file=FILE]] [[-# RANGE] | [--hunks=RANGE]] [--lines=RANGE]\n[[-FRANGE] | [--files=RANGE]] [--annotate] [--as-numbered-lines=WHEN]\n[--format=FORMAT] [--remove-timestamps] [[-v] | [--verbose]] [[-z] | [--decompress]]\n[[-E] | [--extended-regexp]] [[-H] | [--with-filename]] [[-h] | [--no-filename]]\n[--output-matching=WHAT] [--only-match=WHAT] {[REGEX] | [-f FILE]} [file...]\ngrepdiff {[--help] | [--version] | [--list] | [--filter ...]}",
    "sections": {
        "NAME": {
            "content": "grepdiff - show files modified by a diff containing a regex\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "grepdiff [[-n] | [--line-number]] [[-N] | [--number-files]] [[-p n] | [--strip-match=n]]\n[--strip=n] [--addprefix=PREFIX] [--addoldprefix=PREFIX] [--addnewprefix=PREFIX]\n[[-s] | [--status]] [[-i PATTERN] | [--include=PATTERN]] [[-I FILE] |\n[--include-from-file=FILE]] [[-x PATTERN] | [--exclude=PATTERN]] [[-X FILE] |\n[--exclude-from-file=FILE]] [[-# RANGE] | [--hunks=RANGE]] [--lines=RANGE]\n[[-FRANGE] | [--files=RANGE]] [--annotate] [--as-numbered-lines=WHEN]\n[--format=FORMAT] [--remove-timestamps] [[-v] | [--verbose]] [[-z] | [--decompress]]\n[[-E] | [--extended-regexp]] [[-H] | [--with-filename]] [[-h] | [--no-filename]]\n[--output-matching=WHAT] [--only-match=WHAT] {[REGEX] | [-f FILE]} [file...]\n\ngrepdiff {[--help] | [--version] | [--list] | [--filter ...]}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "For each file modified by a patch, if the patch hunk contains the REGEX then the file's name\nis printed.\n\nThe regular expression is treated as POSIX Basic Regular Expression syntax, unless the -E\noption is given in which case POSIX Extended Regular Expression syntax is used.\n\nFor example, to see the patches in my.patch which contain the regular expression\n“pfgfpmask”, use:\n\ngrepdiff pfgfpmask my.patch | \\\nxargs -rn1 filterdiff my.patch -i\n\nYou can use both unified and context format diffs with this program.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-n --line-number",
                    "content": "Display the line number that each patch begins at. If verbose output is requested, each\nmatching hunk is listed as well.\n\nFor a description of the output format see lsdiff(1).\n",
                    "flag": "-n",
                    "long": "--line-number"
                },
                {
                    "name": "-N --number-files",
                    "content": "File numbers are listed, beginning at 1, before each filename.\n",
                    "flag": "-N",
                    "long": "--number-files"
                },
                {
                    "name": "-p --strip-match=",
                    "content": "When matching, ignore the first n components of the pathname.\n\n--strip=n\nRemove the first n components of the pathname before displaying it.\n\n--addprefix=PREFIX\nPrefix the pathname with PREFIX before displaying it. This will override any individual\nsettings specified with the --addoldprefix or --addnewprefix options.\n\n--addoldprefix=PREFIX\nPrefix pathnames for old or original files in the output by PREFIX.\n\n--addnewprefix=PREFIX\nPrefix pathnames for updated or new files in the output by PREFIX.\n",
                    "flag": "-p"
                },
                {
                    "name": "-s",
                    "content": "Show file additions, modifications and removals. A file addition is indicated by a “+”, a\nremoval by a “-”, and a modification by a “!”.\n",
                    "flag": "-s"
                },
                {
                    "name": "-i --include=",
                    "content": "Include only files matching PATTERN.\n",
                    "flag": "-i"
                },
                {
                    "name": "-I --include-from-file=",
                    "content": "Include only files matching any pattern listed in FILE, one pattern per line. All other\nlines in the input are suppressed.\n",
                    "flag": "-I"
                },
                {
                    "name": "-x --exclude=",
                    "content": "Exclude files matching PATTERN.\n",
                    "flag": "-x"
                },
                {
                    "name": "-X --exclude-from-file=",
                    "content": "Exclude files matching any pattern listed in FILE, one pattern per line. All other lines\nin the input are displayed.\n\n-# RANGE, --hunks=RANGE\nOnly include hunks within the specified RANGE. Hunks are numbered from 1, and the range\nis a comma-separated list of numbers or “first-last” spans, optionally preceded by a\nmodifier 'x' which inverts the entire range; either the first or the last in the span may\nbe omitted to indicate no limit in that direction.\n\n--lines=RANGE\nOnly list hunks that contain lines from the original file that lie within the specified\nRANGE. Lines are numbered from 1, and the range is a comma-separated list of numbers or\n“first-last” spans, optionally preceded by a modifier 'x' which inverts the entire range;\neither the first or the last in the span may be omitted to indicate no limit in that\ndirection.\n",
                    "flag": "-X"
                },
                {
                    "name": "-F --files",
                    "content": "Only list files indicated by the specified RANGE. Files are numbered from 1 in the order\nthey appear in the patch input, and the range is a comma-separated list of numbers or\n“first-last” spans, optionally preceded by a modifier 'x' which inverts the entire range;\neither the first or the last in the span may be omitted to indicate no limit in that\ndirection.\n",
                    "flag": "-F",
                    "long": "--files"
                },
                {
                    "name": "--annotate",
                    "content": "Annotate each hunk with the filename and hunk number.\n\n--as-numbered-lines=before|after\nInstead of a patch fragment, display the lines of the selected hunks with the line number\nof the file before (or after) the patch is applied, followed by a TAB character and a\ncolon, at the beginning of each line. Each hunk except the first will have a line\nconsisting of “...”  before it.\n\n--format=unified|context\nUse specified output format.\n",
                    "long": "--annotate"
                },
                {
                    "name": "--remove-timestamps",
                    "content": "Do not include file timestamps in the output.\n",
                    "long": "--remove-timestamps"
                },
                {
                    "name": "-z --decompress",
                    "content": "Decompress files with extensions .gz and .bz2.\n",
                    "flag": "-z",
                    "long": "--decompress"
                },
                {
                    "name": "-E --extended-regexp",
                    "content": "Use POSIX Extended Regular Expression syntax.\n",
                    "flag": "-E",
                    "long": "--extended-regexp"
                },
                {
                    "name": "-H --with-filename",
                    "content": "Print the name of the patch file containing each match.\n",
                    "flag": "-H",
                    "long": "--with-filename"
                },
                {
                    "name": "-h --no-filename",
                    "content": "Suppress the name of the patch file containing each match.\n",
                    "flag": "-h",
                    "long": "--no-filename"
                },
                {
                    "name": "-f --file=",
                    "content": "Read regular expressions from FILE, one per line.\n\n--output-matching=hunk|file\nDisplay the matching hunk-level or file-level diffs.\n\n--only-match=rem|removals|add|additions|mod|modifications|all\nLimit regex matching to removals, additions, modifications or the whole hunk.\n",
                    "flag": "-f"
                },
                {
                    "name": "--help",
                    "content": "Display a short usage message.\n",
                    "long": "--help"
                },
                {
                    "name": "--version",
                    "content": "Display the version number of grepdiff.\n",
                    "long": "--version"
                },
                {
                    "name": "--filter",
                    "content": "Behave like filterdiff(1) instead.\n",
                    "long": "--filter"
                },
                {
                    "name": "--list",
                    "content": "Behave like lsdiff(1) instead.\n",
                    "long": "--list"
                }
            ]
        },
        "SEE ALSO": {
            "content": "filterdiff(1), lsdiff(1), patchview(1)\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Tim Waugh <twaugh@redhat.com>\nPackage maintainer\n\n\n\npatchutils                                   10 Feb 2011                                 GREPDIFF(1)",
            "subsections": []
        }
    },
    "summary": "grepdiff - show files modified by a diff containing a regex",
    "flags": [
        {
            "flag": "-n",
            "long": "--line-number",
            "arg": null,
            "description": "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)."
        },
        {
            "flag": "-N",
            "long": "--number-files",
            "arg": null,
            "description": "File numbers are listed, beginning at 1, before each filename."
        },
        {
            "flag": "-p",
            "long": null,
            "arg": null,
            "description": "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."
        },
        {
            "flag": "-s",
            "long": null,
            "arg": null,
            "description": "Show file additions, modifications and removals. A file addition is indicated by a “+”, a removal by a “-”, and a modification by a “!”."
        },
        {
            "flag": "-i",
            "long": null,
            "arg": null,
            "description": "Include only files matching PATTERN."
        },
        {
            "flag": "-I",
            "long": null,
            "arg": null,
            "description": "Include only files matching any pattern listed in FILE, one pattern per line. All other lines in the input are suppressed."
        },
        {
            "flag": "-x",
            "long": null,
            "arg": null,
            "description": "Exclude files matching PATTERN."
        },
        {
            "flag": "-X",
            "long": null,
            "arg": null,
            "description": "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."
        },
        {
            "flag": "-F",
            "long": "--files",
            "arg": null,
            "description": "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."
        },
        {
            "flag": "",
            "long": "--annotate",
            "arg": null,
            "description": "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."
        },
        {
            "flag": "",
            "long": "--remove-timestamps",
            "arg": null,
            "description": "Do not include file timestamps in the output."
        },
        {
            "flag": "-z",
            "long": "--decompress",
            "arg": null,
            "description": "Decompress files with extensions .gz and .bz2."
        },
        {
            "flag": "-E",
            "long": "--extended-regexp",
            "arg": null,
            "description": "Use POSIX Extended Regular Expression syntax."
        },
        {
            "flag": "-H",
            "long": "--with-filename",
            "arg": null,
            "description": "Print the name of the patch file containing each match."
        },
        {
            "flag": "-h",
            "long": "--no-filename",
            "arg": null,
            "description": "Suppress the name of the patch file containing each match."
        },
        {
            "flag": "-f",
            "long": null,
            "arg": null,
            "description": "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."
        },
        {
            "flag": "",
            "long": "--help",
            "arg": null,
            "description": "Display a short usage message."
        },
        {
            "flag": "",
            "long": "--version",
            "arg": null,
            "description": "Display the version number of grepdiff."
        },
        {
            "flag": "",
            "long": "--filter",
            "arg": null,
            "description": "Behave like filterdiff(1) instead."
        },
        {
            "flag": "",
            "long": "--list",
            "arg": null,
            "description": "Behave like lsdiff(1) instead."
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "filterdiff",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/filterdiff/1/json"
        },
        {
            "name": "lsdiff",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/lsdiff/1/json"
        },
        {
            "name": "patchview",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/patchview/1/json"
        }
    ]
}