grepdiff
Search patches for matching lines
SYNOPSIS
grepdiff [options] pattern [patchfile|-]
PARAMETERS
-pn
Strip n leading path components from file names.
-i
Ignore case distinctions in both the pattern and the input files.
-I pattern
Ignore differences whose changed lines all match pattern.
-l
List only file names containing matching lines.
-L
List only file names not containing matching lines.
-n
Prefix each line of output with the line number within its file.
-s
Suppress error messages about unreadable files.
-z
Treat the patch file as compressed with gzip.
-a
Process all files as text.
--additions
Show only added lines.
--deletions
Show only deleted lines.
--files
Show only the files that match the pattern.
--binary
Search binary files.
--strip-trailing-cr
Strip trailing carriage return characters from input files.
DESCRIPTION
The grepdiff command is a powerful tool used to search for lines matching a specified pattern within the files modified by a patch or diff file. It allows users to selectively examine the changes introduced by a patch, focusing on specific code segments or patterns. This is particularly useful when reviewing large patches or trying to isolate the impact of particular code modifications. grepdiff uses the standard grep engine for pattern matching. By default, it only searches files that are present according to the patch and ignores addition or removal of files. It can also search added/removed files if parameters are used.
It supports various options for tailoring the search, such as ignoring case differences or interpreting patterns as regular expressions. grepdiff is often used in conjunction with commands like diff and patch to streamline the process of code review and patch application. It simplifies the task of verifying that changes meet specific criteria and helps to prevent unintended side effects.
EXIT STATUS
The exit status is 0 if selected lines are found, 1 otherwise.