/usr/share/doc/diffutils-doc/Invoking-patch.html is in diffutils-doc 1:3.5-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- This manual is for GNU Diffutils
(version 3.5, 4 August 2016),
and documents the GNU diff, diff3,
sdiff, and cmp commands for showing the
differences between files and the GNU patch command for
using their output to update files.
Copyright (C) 1992-1994, 1998, 2001-2002, 2004, 2006, 2009-2016 Free
Software Foundation, Inc.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or
any later version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
A copy of the license is included in the section entitled
"GNU Free Documentation License." -->
<!-- Created by GNU Texinfo 6.3, http://www.gnu.org/software/texinfo/ -->
<head>
<title>Comparing and Merging Files: Invoking patch</title>
<meta name="description" content="Comparing and Merging Files: Invoking patch">
<meta name="keywords" content="Comparing and Merging Files: Invoking patch">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Index.html#Index" rel="index" title="Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="Invoking-sdiff.html#Invoking-sdiff" rel="next" title="Invoking sdiff">
<link href="Invoking-diff3.html#diff3-Options" rel="prev" title="diff3 Options">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="Invoking-patch"></a>
<div class="header">
<p>
Next: <a href="Invoking-sdiff.html#Invoking-sdiff" accesskey="n" rel="next">Invoking sdiff</a>, Previous: <a href="Invoking-diff3.html#Invoking-diff3" accesskey="p" rel="prev">Invoking diff3</a>, Up: <a href="index.html#Top" accesskey="u" rel="up">Top</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Invoking-patch-1"></a>
<h2 class="chapter">15 Invoking <code>patch</code></h2>
<a name="index-invoking-patch"></a>
<a name="index-patch-invocation"></a>
<p>Normally <code>patch</code> is invoked like this:
</p>
<div class="example">
<pre class="example">patch <<var>patchfile</var>
</pre></div>
<p>The full format for invoking <code>patch</code> is:
</p>
<div class="example">
<pre class="example">patch <var>options</var>… <span class="roman">[</span><var>origfile</var> <span class="roman">[</span><var>patchfile</var><span class="roman">]</span><span class="roman">]</span>
</pre></div>
<p>You can also specify where to read the patch from with the <samp>-i
<var>patchfile</var></samp> or <samp>--input=<var>patchfile</var></samp> option.
If you do not specify <var>patchfile</var>, or if <var>patchfile</var> is
<samp>-</samp>, <code>patch</code> reads the patch (that is, the <code>diff</code> output)
from the standard input.
</p>
<p>If you do not specify an input file on the command line, <code>patch</code>
tries to intuit from the <em>leading text</em> (any text in the patch
that comes before the <code>diff</code> output) which file to edit.
See <a href="Merging-with-patch.html#Multiple-Patches">Multiple Patches</a>.
</p>
<p>By default, <code>patch</code> replaces the original input file with the
patched version, possibly after renaming the original file into a
backup file (see <a href="Merging-with-patch.html#Backup-Names">Backup Names</a>, for a description of how
<code>patch</code> names backup files). You can also specify where to
put the output with the <samp>-o <var>file</var></samp> or
<samp>--output=<var>file</var></samp> option; however, do not use this option
if <var>file</var> is one of the input files.
</p>
<table class="menu" border="0" cellspacing="0">
<tr><td align="left" valign="top">• <a href="#patch-Options" accesskey="1">patch Options</a>:</td><td> </td><td align="left" valign="top">Summary table of options to <code>patch</code>.
</td></tr>
</table>
<hr>
<a name="patch-Options"></a>
<div class="header">
<p>
Up: <a href="#Invoking-patch" accesskey="u" rel="up">Invoking patch</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
<a name="Options-to-patch"></a>
<h3 class="section">15.1 Options to <code>patch</code></h3>
<a name="index-patch-options"></a>
<a name="index-options-for-patch"></a>
<p>Here is a summary of all of the options that <acronym>GNU</acronym> <code>patch</code>
accepts. See <a href="Merging-with-patch.html#patch-and-Tradition">patch and Tradition</a>, for which of these options are
safe to use in older versions of <code>patch</code>.
</p>
<p>Multiple single-letter options that do not take an argument can be
combined into a single command line argument with only one dash.
</p>
<dl compact="compact">
<dt><samp>-b</samp></dt>
<dt><samp>--backup</samp></dt>
<dd><p>Back up the original contents of each file, even if backups would
normally not be made. See <a href="Merging-with-patch.html#Backups">Backups</a>.
</p>
</dd>
<dt><samp>-B <var>prefix</var></samp></dt>
<dt><samp>--prefix=<var>prefix</var></samp></dt>
<dd><p>Prepend <var>prefix</var> to backup file names. See <a href="Merging-with-patch.html#Backup-Names">Backup Names</a>.
</p>
</dd>
<dt><samp>--backup-if-mismatch</samp></dt>
<dd><p>Back up the original contents of each file if the patch does not
exactly match the file. This is the default behavior when not
conforming to <acronym>POSIX</acronym>. See <a href="Merging-with-patch.html#Backups">Backups</a>.
</p>
</dd>
<dt><samp>--binary</samp></dt>
<dd><p>Read and write all files in binary mode, except for standard output
and <samp>/dev/tty</samp>. This option has no effect on
<acronym>POSIX</acronym>-conforming systems like <acronym>GNU</acronym>/Linux. On systems where
this option makes a difference, the patch should be generated by
‘<samp>diff -a --binary</samp>’. See <a href="Comparison.html#Binary">Binary</a>.
</p>
</dd>
<dt><samp>-c</samp></dt>
<dt><samp>--context</samp></dt>
<dd><p>Interpret the patch file as a context diff. See <a href="Merging-with-patch.html#patch-Input">patch Input</a>.
</p>
</dd>
<dt><samp>-d <var>directory</var></samp></dt>
<dt><samp>--directory=<var>directory</var></samp></dt>
<dd><p>Make directory <var>directory</var> the current directory for interpreting
both file names in the patch file, and file names given as arguments to
other options. See <a href="Merging-with-patch.html#patch-Directories">patch Directories</a>.
</p>
</dd>
<dt><samp>-D <var>name</var></samp></dt>
<dt><samp>--ifdef=<var>name</var></samp></dt>
<dd><p>Make merged if-then-else output using <var>name</var>. See <a href="Output-Formats.html#If_002dthen_002delse">If-then-else</a>.
</p>
</dd>
<dt><samp>--dry-run</samp></dt>
<dd><p>Print the results of applying the patches without actually changing
any files. See <a href="Merging-with-patch.html#Dry-Runs">Dry Runs</a>.
</p>
</dd>
<dt><samp>-e</samp></dt>
<dt><samp>--ed</samp></dt>
<dd><p>Interpret the patch file as an <code>ed</code> script. See <a href="Merging-with-patch.html#patch-Input">patch Input</a>.
</p>
</dd>
<dt><samp>-E</samp></dt>
<dt><samp>--remove-empty-files</samp></dt>
<dd><p>Remove output files that are empty after the patches have been applied.
See <a href="Merging-with-patch.html#Creating-and-Removing">Creating and Removing</a>.
</p>
</dd>
<dt><samp>-f</samp></dt>
<dt><samp>--force</samp></dt>
<dd><p>Assume that the user knows exactly what he or she is doing, and do not
ask any questions. See <a href="Merging-with-patch.html#patch-Messages">patch Messages</a>.
</p>
</dd>
<dt><samp>-F <var>lines</var></samp></dt>
<dt><samp>--fuzz=<var>lines</var></samp></dt>
<dd><p>Set the maximum fuzz factor to <var>lines</var>. See <a href="Merging-with-patch.html#Inexact">Inexact</a>.
</p>
</dd>
<dt><samp>-g <var>num</var></samp></dt>
<dt><samp>--get=<var>num</var></samp></dt>
<dd><p>If <var>num</var> is positive, get input files from a revision control
system as necessary; if zero, do not get the files; if negative, ask
the user whether to get the files. See <a href="Merging-with-patch.html#Revision-Control">Revision Control</a>.
</p>
</dd>
<dt><samp>--help</samp></dt>
<dd><p>Output a summary of usage and then exit.
</p>
</dd>
<dt><samp>-i <var>patchfile</var></samp></dt>
<dt><samp>--input=<var>patchfile</var></samp></dt>
<dd><p>Read the patch from <var>patchfile</var> rather than from standard input.
See <a href="#patch-Options">patch Options</a>.
</p>
</dd>
<dt><samp>-l</samp></dt>
<dt><samp>--ignore-white-space</samp></dt>
<dd><p>Let any sequence of blanks (spaces or tabs) in the patch file match
any sequence of blanks in the input file. See <a href="Merging-with-patch.html#Changed-White-Space">Changed White Space</a>.
</p>
</dd>
<dt><samp>-n</samp></dt>
<dt><samp>--normal</samp></dt>
<dd><p>Interpret the patch file as a normal diff. See <a href="Merging-with-patch.html#patch-Input">patch Input</a>.
</p>
</dd>
<dt><samp>-N</samp></dt>
<dt><samp>--forward</samp></dt>
<dd><p>Ignore patches that <code>patch</code> thinks are reversed or already applied.
See also <samp>-R</samp>. See <a href="Merging-with-patch.html#Reversed-Patches">Reversed Patches</a>.
</p>
</dd>
<dt><samp>--no-backup-if-mismatch</samp></dt>
<dd><p>Do not back up the original contents of files. This is the default
behavior when conforming to <acronym>POSIX</acronym>. See <a href="Merging-with-patch.html#Backups">Backups</a>.
</p>
</dd>
<dt><samp>-o <var>file</var></samp></dt>
<dt><samp>--output=<var>file</var></samp></dt>
<dd><p>Use <var>file</var> as the output file name. See <a href="#patch-Options">patch Options</a>.
</p>
</dd>
<dt><samp>-p<var>number</var></samp></dt>
<dt><samp>--strip=<var>number</var></samp></dt>
<dd><p>Set the file name strip count to <var>number</var>. See <a href="Merging-with-patch.html#patch-Directories">patch Directories</a>.
</p>
</dd>
<dt><samp>--posix</samp></dt>
<dd><p>Conform to <acronym>POSIX</acronym>, as if the <code>POSIXLY_CORRECT</code> environment
variable had been set. See <a href="Merging-with-patch.html#patch-and-POSIX">patch and POSIX</a>.
</p>
</dd>
<dt><samp>--quoting-style=<var>word</var></samp></dt>
<dd><p>Use style <var>word</var> to quote names in diagnostics, as if the
<code>QUOTING_STYLE</code> environment variable had been set to <var>word</var>.
See <a href="Merging-with-patch.html#patch-Quoting-Style">patch Quoting Style</a>.
</p>
</dd>
<dt><samp>-r <var>reject-file</var></samp></dt>
<dt><samp>--reject-file=<var>reject-file</var></samp></dt>
<dd><p>Use <var>reject-file</var> as the reject file name. See <a href="Merging-with-patch.html#Reject-Names">Reject Names</a>.
</p>
</dd>
<dt><samp>-R</samp></dt>
<dt><samp>--reverse</samp></dt>
<dd><p>Assume that this patch was created with the old and new files swapped.
See <a href="Merging-with-patch.html#Reversed-Patches">Reversed Patches</a>.
</p>
</dd>
<dt><samp>-s</samp></dt>
<dt><samp>--quiet</samp></dt>
<dt><samp>--silent</samp></dt>
<dd><p>Work silently unless an error occurs. See <a href="Merging-with-patch.html#patch-Messages">patch Messages</a>.
</p>
</dd>
<dt><samp>-t</samp></dt>
<dt><samp>--batch</samp></dt>
<dd><p>Do not ask any questions. See <a href="Merging-with-patch.html#patch-Messages">patch Messages</a>.
</p>
</dd>
<dt><samp>-T</samp></dt>
<dt><samp>--set-time</samp></dt>
<dd><p>Set the modification and access times of patched files from time
stamps given in context diff headers, assuming that the context diff
headers use local time. See <a href="Merging-with-patch.html#Patching-Time-Stamps">Patching Time Stamps</a>.
</p>
</dd>
<dt><samp>-u</samp></dt>
<dt><samp>--unified</samp></dt>
<dd><p>Interpret the patch file as a unified diff. See <a href="Merging-with-patch.html#patch-Input">patch Input</a>.
</p>
</dd>
<dt><samp>-v</samp></dt>
<dt><samp>--version</samp></dt>
<dd><p>Output version information and then exit.
</p>
</dd>
<dt><samp>-V <var>backup-style</var></samp></dt>
<dt><samp>--version=control=<var>backup-style</var></samp></dt>
<dd><p>Select the naming convention for backup file names. See <a href="Merging-with-patch.html#Backup-Names">Backup Names</a>.
</p>
</dd>
<dt><samp>--verbose</samp></dt>
<dd><p>Print more diagnostics than usual. See <a href="Merging-with-patch.html#patch-Messages">patch Messages</a>.
</p>
</dd>
<dt><samp>-x <var>number</var></samp></dt>
<dt><samp>--debug=<var>number</var></samp></dt>
<dd><p>Set internal debugging flags. Of interest only to <code>patch</code>
patchers.
</p>
</dd>
<dt><samp>-Y <var>prefix</var></samp></dt>
<dt><samp>--basename-prefix=<var>prefix</var></samp></dt>
<dd><p>Prepend <var>prefix</var> to base names of backup files. See <a href="Merging-with-patch.html#Backup-Names">Backup Names</a>.
</p>
</dd>
<dt><samp>-z <var>suffix</var></samp></dt>
<dt><samp>--suffix=<var>suffix</var></samp></dt>
<dd><p>Use <var>suffix</var> as the backup extension instead of ‘<samp>.orig</samp>’ or
‘<samp>~</samp>’. See <a href="Merging-with-patch.html#Backup-Names">Backup Names</a>.
</p>
</dd>
<dt><samp>-Z</samp></dt>
<dt><samp>--set-utc</samp></dt>
<dd><p>Set the modification and access times of patched files from time
stamps given in context diff headers, assuming that the context diff
headers use <acronym>UTC</acronym>. See <a href="Merging-with-patch.html#Patching-Time-Stamps">Patching Time Stamps</a>.
</p>
</dd>
</dl>
<hr>
<div class="header">
<p>
Up: <a href="#Invoking-patch" accesskey="u" rel="up">Invoking patch</a> [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html#Index" title="Index" rel="index">Index</a>]</p>
</div>
</body>
</html>
|