- Unix Commands Reference
- Unix - Tutorial Home
diffstat - Unix, Linux Command
NAMEdiffstat - make histogram from diff-output
SYNOPSISdiffstat [options] [file-specifications]
DESCRIPTIONThis program reads the output of diff and displays a histogram of the insertions, deletions, and modifications per-file. Diffstat is a program that is useful for reviewing large, complex patch files. It reads from one or more input files which contain output from diff, producing a histogram of the total lines changed for each file referenced. If the input filename ends with .bz2, .Z or .gz, diffstat will read the uncompressed data via a pipe from the corresponding program.
Diffstat recognizes the most popular types of output from diff:
|preferred by the patch utility.
|best for readability, but not very compact.
|not good for much, but simple to generate.
Diffstat detects the lines that are output by diff to tell which files are compared, and then counts the markers in the first column that denote the type of change (insertion, deletion or modification). These are shown in the histogram as "+", "-" and "!" characters.
If no filename is given on the command line, diffstat reads the differences from the standard input.
|prefix each line of output with "#", making it a comment-line for shell scripts.
|redirect standard error to file.
specify the format of the histogram.
|Any nonzero value gives a histogram. The dots and individual values can be combined, e.g., -f6 gives both.
|prints the usage message and exits.
|suppress the merging of filenames in the report.
|lists only the filenames. No histogram is generated.
|specify the minimum width used for filenames. If you dont specify this, diffstat uses the length of the longest filename, after stripping common prefixes.
|redirect standard output to file.
|override the logic that strips common pathnames, simulating the patch "-p" option.
provides optional rounding of the data shown in histogram,
rather than truncating with error adjustments.
|overrides the histogram, generates output of comma separated values.
|suppress the sorting of filenames in the report.
|show progress, e.g., if the output is redirected to a file, write progress messages to the standard error.
|prints the current version number and exits.
|specify the maximum width of the histogram. The histogram will never be shorter than 10 columns, just in case the filenames get too large.
Diffstat runs in a portable UNIX® environment.
Diffstat is a single binary module, which uses no auxiliary files.
Diffstat makes a lot of assumptions about the format of a diff file.
There is no way to obtain a filename from the standard diff between two files with no options. Context diffs work, as well as unified diffs.
Theres no easy way to determine the degree of overlap between the "before" and "after" displays of modified lines.
Thomas Dickey <email@example.com>.