man-pages/man1/diff.1.html
2021-03-31 01:06:50 +01:00

255 lines
8.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of GNU</TITLE>
</HEAD><BODY>
<H1>GNU</H1>
Section: User Commands (1)<BR>Updated: December 2018<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
GNU diff - compare files line by line
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>diff</B>
[<I>OPTION</I>]... <I>FILES</I>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
Compare FILES line by line.
<P>
Mandatory arguments to long options are mandatory for short options too.
<DL COMPACT>
<DT id="1"><B>--normal</B><DD>
output a normal diff (the default)
<DT id="2"><B>-q</B>, <B>--brief</B><DD>
report only when files differ
<DT id="3"><B>-s</B>, <B>--report-identical-files</B><DD>
report when two files are the same
<DT id="4"><B>-c</B>, <B>-C</B> NUM, <B>--context</B>[=<I>NUM</I>]<DD>
output NUM (default 3) lines of copied context
<DT id="5"><B>-u</B>, <B>-U</B> NUM, <B>--unified</B>[=<I>NUM</I>]<DD>
output NUM (default 3) lines of unified context
<DT id="6"><B>-e</B>, <B>--ed</B><DD>
output an ed script
<DT id="7"><B>-n</B>, <B>--rcs</B><DD>
output an RCS format diff
<DT id="8"><B>-y</B>, <B>--side-by-side</B><DD>
output in two columns
<DT id="9"><B>-W</B>, <B>--width</B>=<I>NUM</I><DD>
output at most NUM (default 130) print columns
<DT id="10"><B>--left-column</B><DD>
output only the left column of common lines
<DT id="11"><B>--suppress-common-lines</B><DD>
do not output common lines
<DT id="12"><B>-p</B>, <B>--show-c-function</B><DD>
show which C function each change is in
<DT id="13"><B>-F</B>, <B>--show-function-line</B>=<I>RE</I><DD>
show the most recent line matching RE
<DT id="14"><B>--label</B> LABEL<DD>
use LABEL instead of file name and timestamp
(can be repeated)
<DT id="15"><B>-t</B>, <B>--expand-tabs</B><DD>
expand tabs to spaces in output
<DT id="16"><B>-T</B>, <B>--initial-tab</B><DD>
make tabs line up by prepending a tab
<DT id="17"><B>--tabsize</B>=<I>NUM</I><DD>
tab stops every NUM (default 8) print columns
<DT id="18"><B>--suppress-blank-empty</B><DD>
suppress space or tab before empty output lines
<DT id="19"><B>-l</B>, <B>--paginate</B><DD>
pass output through 'pr' to paginate it
<DT id="20"><B>-r</B>, <B>--recursive</B><DD>
recursively compare any subdirectories found
<DT id="21"><B>--no-dereference</B><DD>
don't follow symbolic links
<DT id="22"><B>-N</B>, <B>--new-file</B><DD>
treat absent files as empty
<DT id="23"><B>--unidirectional-new-file</B><DD>
treat absent first files as empty
<DT id="24"><B>--ignore-file-name-case</B><DD>
ignore case when comparing file names
<DT id="25"><B>--no-ignore-file-name-case</B><DD>
consider case when comparing file names
<DT id="26"><B>-x</B>, <B>--exclude</B>=<I>PAT</I><DD>
exclude files that match PAT
<DT id="27"><B>-X</B>, <B>--exclude-from</B>=<I>FILE</I><DD>
exclude files that match any pattern in FILE
<DT id="28"><B>-S</B>, <B>--starting-file</B>=<I>FILE</I><DD>
start with FILE when comparing directories
<DT id="29"><B>--from-file</B>=<I>FILE1</I><DD>
compare FILE1 to all operands;
FILE1 can be a directory
<DT id="30"><B>--to-file</B>=<I>FILE2</I><DD>
compare all operands to FILE2;
FILE2 can be a directory
<DT id="31"><B>-i</B>, <B>--ignore-case</B><DD>
ignore case differences in file contents
<DT id="32"><B>-E</B>, <B>--ignore-tab-expansion</B><DD>
ignore changes due to tab expansion
<DT id="33"><B>-Z</B>, <B>--ignore-trailing-space</B><DD>
ignore white space at line end
<DT id="34"><B>-b</B>, <B>--ignore-space-change</B><DD>
ignore changes in the amount of white space
<DT id="35"><B>-w</B>, <B>--ignore-all-space</B><DD>
ignore all white space
<DT id="36"><B>-B</B>, <B>--ignore-blank-lines</B><DD>
ignore changes where lines are all blank
<DT id="37"><B>-I</B>, <B>--ignore-matching-lines</B>=<I>RE</I><DD>
ignore changes where all lines match RE
<DT id="38"><B>-a</B>, <B>--text</B><DD>
treat all files as text
<DT id="39"><B>--strip-trailing-cr</B><DD>
strip trailing carriage return on input
<DT id="40"><B>-D</B>, <B>--ifdef</B>=<I>NAME</I><DD>
output merged file with '#ifdef NAME' diffs
<DT id="41"><B>--GTYPE-group-format</B>=<I>GFMT</I><DD>
format GTYPE input groups with GFMT
<DT id="42"><B>--line-format</B>=<I>LFMT</I><DD>
format all input lines with LFMT
<DT id="43"><B>--LTYPE-line-format</B>=<I>LFMT</I><DD>
format LTYPE input lines with LFMT
<DT id="44"><DD>
These format options provide fine-grained control over the output
<DT id="45"><DD>
of diff, generalizing <B>-D</B>/--ifdef.
<DT id="46">LTYPE is 'old', 'new', or 'unchanged'.<DD>
GTYPE is LTYPE or 'changed'.
<DT id="47"><DD>
GFMT (only) may contain:
<DT id="48">%&lt;<DD>
lines from FILE1
<DT id="49">%&gt;<DD>
lines from FILE2
<DT id="50">%=<DD>
lines common to FILE1 and FILE2
<DT id="51">%[-][WIDTH][.[PREC]]{doxX}LETTER<DD>
printf-style spec for LETTER
<DT id="52"><DD>
LETTERs are as follows for new group, lower case for old group:
<DT id="53">F<DD>
first line number
<DT id="54">L<DD>
last line number
<DT id="55">N<DD>
number of lines = L-F+1
<DT id="56">E<DD>
F-1
<DT id="57">M<DD>
L+1
<DT id="58">%(A=B?T:E)<DD>
if A equals B then T else E
<DT id="59"><DD>
LFMT (only) may contain:
<DT id="60">%L<DD>
contents of line
<DT id="61">%l<DD>
contents of line, excluding any trailing newline
<DT id="62">%[-][WIDTH][.[PREC]]{doxX}n<DD>
printf-style spec for input line number
<DT id="63"><DD>
Both GFMT and LFMT may contain:
<DT id="64">%%<DD>
%
<DT id="65">%c'C'<DD>
the single character C
<DT id="66">%c'\OOO'<DD>
the character with octal code OOO
<DT id="67">C<DD>
the character C (other characters represent themselves)
<DT id="68"><B>-d</B>, <B>--minimal</B><DD>
try hard to find a smaller set of changes
<DT id="69"><B>--horizon-lines</B>=<I>NUM</I><DD>
keep NUM lines of the common prefix and suffix
<DT id="70"><B>--speed-large-files</B><DD>
assume large files and many scattered small changes
<DT id="71"><B>--color</B>[=<I>WHEN</I>]<DD>
colorize the output; WHEN can be 'never', 'always',
or 'auto' (the default)
<DT id="72"><B>--palette</B>=<I>PALETTE</I><DD>
the colors to use when <B>--color</B> is active; PALETTE is
a colon-separated list of terminfo capabilities
<DT id="73"><B>--help</B><DD>
display this help and exit
<DT id="74"><B>-v</B>, <B>--version</B><DD>
output version information and exit
</DL>
<P>
FILES are 'FILE1 FILE2' or 'DIR1 DIR2' or 'DIR FILE' or 'FILE DIR'.
If <B>--from-file</B> or <B>--to-file</B> is given, there are no restrictions on FILE(s).
If a FILE is '-', read standard input.
Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.
<A NAME="lbAE">&nbsp;</A>
<H2>AUTHOR</H2>
Written by Paul Eggert, Mike Haertel, David Hayes,
Richard Stallman, and Len Tower.
<A NAME="lbAF">&nbsp;</A>
<H2>REPORTING BUGS</H2>
Report bugs to: <A HREF="mailto:bug-diffutils@gnu.org">bug-diffutils@gnu.org</A>
<BR>
GNU diffutils home page: &lt;<A HREF="https://www.gnu.org/software/diffutils/">https://www.gnu.org/software/diffutils/</A>&gt;
<BR>
General help using GNU software: &lt;<A HREF="https://www.gnu.org/gethelp/">https://www.gnu.org/gethelp/</A>&gt;
<A NAME="lbAG">&nbsp;</A>
<H2>COPYRIGHT</H2>
Copyright &#169; 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later &lt;<A HREF="https://gnu.org/licenses/gpl.html">https://gnu.org/licenses/gpl.html</A>&gt;.
<BR>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<A HREF="/cgi-bin/man/man2html?1+wdiff">wdiff</A>(1), <A HREF="/cgi-bin/man/man2html?1+cmp">cmp</A>(1), <A HREF="/cgi-bin/man/man2html?1+diff3">diff3</A>(1), <A HREF="/cgi-bin/man/man2html?1+sdiff">sdiff</A>(1), <A HREF="/cgi-bin/man/man2html?1+patch">patch</A>(1)
<P>
The full documentation for
<B>GNU</B>
is maintained as a Texinfo manual. If the
<B>info</B>
and
<B>GNU</B>
programs are properly installed at your site, the command
<DL COMPACT>
<DT id="75"><DD>
<B>info GNU</B>
</DL>
<P>
should give you access to the complete manual.
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="76"><A HREF="#lbAB">NAME</A><DD>
<DT id="77"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="78"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="79"><A HREF="#lbAE">AUTHOR</A><DD>
<DT id="80"><A HREF="#lbAF">REPORTING BUGS</A><DD>
<DT id="81"><A HREF="#lbAG">COPYRIGHT</A><DD>
<DT id="82"><A HREF="#lbAH">SEE ALSO</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:11 GMT, March 31, 2021
</BODY>
</HTML>