ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahz_5.4.0.1/cmp.htm

117 lines
3.1 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content=
"text/html; charset=utf-8">
<title>cmp - Compare two files</title>
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</HEAD>
<body bgcolor="#FFFFFF">
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h2>cmp - Compare two files</h2>
<strong>Synopsis</strong>
<p><strong>cmp [-l | -s] [-t]</strong> <em>file1 file2</em>
[<em>skip1</em> [<em>skip2</em>]]</p>
<p><strong>Description</strong></p>
<p>You can use <strong>cmp</strong> to compare two files. By
default, a byte for byte binary comparison is done. If no
differences are found, no output is written. If no option flags are
specified, <strong>cmp</strong> writes a message with the byte and
line number of the first difference and exits with an error. Bytes
and lines are numbered beginning with 1.</p>
<p><strong>Options</strong></p>
<dl>
<dt><strong>-l</strong></dt>
<dd>(Lower case ell) Write the byte number in decimal and the
differing bytes in octal for all differences.</dd>
<dt><strong>-s</strong></dt>
<dd>Silent mode where no output is written for differing files;
only the exit status is set.</dd>
<dt><strong>-t</strong></dt>
<dd>Text mode where the files are opened in text mode and
translated to the CCSID of the job before comparing byte for
byte.</dd>
</dl>
<p><strong>Operands</strong></p>
<p>The <em>file1</em> and <em>file2</em> operands are the two files
to be compared byte for byte. The optional <em>skip1</em> and <em>
skip2</em> are the number of bytes to skip from the beginning of
each file, respectively, before the comparison begins.</p>
<p><img src="delta.gif" alt="Start of change"><strong>Environment Variables</strong></p>
<p><strong>cmp</strong> is affected by the following environment
variables:</p>
<dl>
<dt><strong>QIBM_CMP_FILE_SIZE</strong></dt>
<dd>Controls the maximum file size in bytes that <strong>cmp</strong> reads
into an internal buffer for better performance. For files larger than the
maximum size, <strong>cmp</strong> reads the files one byte at a time.</dd>
</dl><img src="deltaend.gif" alt="End of change">
<p><strong>Exit Status</strong></p>
<ul>
<li>0 when the files are identical</li>
<li>1 when the files are different</li>
<li>&gt;1 when an error occurred</li>
</ul>
<p><strong>Related information</strong></p>
<ul>
<li><a href="sed.htm">sed - Stream editor</a></li>
<li><a href="sort.htm">sort - Sort, merge, or sequence check text
files</a></li>
<li><a href="split.htm">split - Split files into pieces</a></li>
<li><a href="uniq.htm">uniq - Report or filter out repeated lines
in a file</a></li>
</ul>
<strong>Examples</strong>
<ol>
<li>Find the exact position where two files differ. It is better to
place the reference or good file first and then the changed or new
file second.
<pre>
cmp myApplet.java.old myApplet.java.new
</pre>
</li>
</ol>
<!-- end ibmbody========================================================= -->
</body>
</html>