Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ diffh(1) — HP-UX 7.01

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

bdiff(1)

cmp(1)

comm(1)

diff3(1)

diffmk(1)

dircmp(1)

ed(1)

more(1)

nroff(1)

rcsdiff(1)

sccsdiff(1)

sdiff(1)

terminfo(4)

DIFF(1)

NAME

diff, diffh − differential file comparator

SYNOPSIS

diff [−befh] file1 file2

/usr/lib/diffh [−b] file1 file2

DESCRIPTION

Diff tells what lines must be changed in two files to bring them into agreement.  If file1 (file2) is −, the standard input is used.  If file1 (file2) is a directory, a file in that directory named file2 (file1) is used. The normal output contains lines of these forms:

n1 a n3,n4
n1,n2 d n3
n1,n2 c n3,n4

These lines resemble ed(1) commands to convert file1 into file2. The numbers after the letters pertain to file2. In fact, by exchanging a for d and reading backward one may ascertain equally how to convert file2 into file1. As in ed, identical pairs (where n1 = n2 or n3 = n4) are abbreviated as a single number.

By default, each line affected in file1 is flagged by <; each line affected in file2 is flagged by >. 

Options

−b Cause trailing blanks (spaces and tabs) to be ignored and other strings of blanks to compare equally. 

−e Produce a script of a, c, and d commands for the editor ed(1) to recreate file2 from file1.

−f Produce a script similar to that of −e, but in the opposite order.  The −f option is not useful with ed(1).

−h Do a fast, half-hearted job.  The −h option works only when changed segments of text are short and well-separated, although it does work on files of unlimited length.  Options −e and −f are unavailable with −h. 

Diffh is equivalent to diff −h.  It must be invoked as shown above in the SYNOPSIS, unless the PATH variable in your environment includes the directory /usr/lib. 

The following shell program might help maintain multiple versions of a file when using the −e option.  Only an ancestral file ($1) and a chain of version-to-version ed scripts ($2,$3,...) made by diff need be available.  A “latest version” appears as the standard output. 

(shift; cat $∗; echo ´1,$p´) │ ed − $1

Except in rare circumstances, diff finds a smallest sufficient set of file differences. 

DIAGNOSTICS

Exit status is 0 for no differences, 1 for some differences, 2 for trouble. 

EXAMPLES

The following command produces a list of editor commands that when interpreted by ed(1), recreate new_site from site if new_site is an updated copy of site. 

diff -e site new_site

WARNINGS

Editing scripts produced under the −e or −f option are naive about creating lines consisting of a single period (.). 

Missing newline at end of file X indicates that the last line of file X did not have a new-line.  If the lines are different, they will be flagged and output, although the output will seem to indicate they are the same. 

AUTHOR

Diff was developed by AT&T, the University of California, Berkeley, and HP. 

FILES

/tmp/d????? 

/usr/lib/diffh for −h

SEE ALSO

bdiff(1), cmp(1), comm(1), diff3(1), diffmk(1), dircmp(1), ed(1), more(1), nroff(1), rcsdiff(1), sccsdiff(1), sdiff(1), terminfo(4). 

EXTERNAL INFLUENCES

Environment Variables

LC_CTYPE determines the space characters for the diff command. 

LANG determines the language in which messages are displayed. 

If LC_CTYPE is not specified in the environment or is set to the empty string, the value of LANG is used as a default for each unspecified or empty variable.  If LANG is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of LANG.  If any internationalization variable contains an invalid setting, diff and diffh behave as if all internationalization variables are set to "C".  See environ(5).

International Code Set Support

Single- and multi-byte character code sets are supported with the exception that diff and diffh do not recognize multi-byte alternative space characters. 

STANDARDS CONFORMANCE

diff: SVID2, XPG2, XPG3

Hewlett-Packard Company  —  HP-UX Release 7.0: Sept 1989

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026