P. 1
HPUX- Command A - M

HPUX- Command A - M

|Views: 3.067|Likes:
Publicado porT.S.A.Zahir Hussain

More info:

Published by: T.S.A.Zahir Hussain on Sep 02, 2009
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less








within 3 lines of each other in the file are grouped together on output.

-C n Output format similar to -c but with n lines of context.


Do a fast, half-hearted job. This option works only when changed stretches are short and
well separated, but can be used on files of unlimited length.

-D string

Create a merged version of file1 and file2 on the standard output, with C preprocessor con-
trols included so that a compilation of the result without defining string is equivalent to
compiling file1, while compiling the result with string defined is equivalent to compiling


Ignore trailing blanks (spaces and tabs) and treat other strings of blanks as equal.


Ignore all whitespace (blanks and tabs). For example, if ( a == b ) and
if(a==b) are treated as equal.


Ignores uppercase/lowercase differences. Thus A is treated the same as a.


Expand tabs in output lines. Normal or -c output adds one or more characters to the
front of each line. Resulting misalignment of indentation in the original source lines can
make the output listing difficult to interpret. This option preserves original source file

Environment Variables

LANG determines the locale to use for the locale categories when both LC_ALL and the corresponding
environment variable (beginning with LC_) do not specify a locale. If LANG is not set or is set to the
empty string, a default of "C" (see lang(5)) is used.

LC_CTYPE determines the space characters for the diff command, and the interpretation of text
within file as single- and/or multi-byte characters.

LC_MESSAGES determines the language in which messages are displayed.

If any internationalization variable contains an invalid setting, diff and diffh behave as if all inter-
nationalization 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.


Upon completion, diff returns with one of the following exit values:

0 No differences were found.

1 Differences were found.

>1 An error occurred.


The following command creates a script file script:

diff -e x1 x2 >script

w is added to the end of the script in order to save the file:

echo w >> script

The script file can then be used to create the file x2 from the file x1 using the editor ed in the following

ed x1 < script

The following command produces the difference output with 2 lines of context information before and
after the line that was different:

diff -C2 x1 x2

The following command ignores all blanks and tabs and ignores uppercase-lowercase differences.

HP-UX 11i Version 2: August 2003

− 2 −

Hewlett-Packard Company Section 1−−177




diff -wi x1 x2


Editing scripts produced by the -e or -f option are naive about creating lines consisting of a single dot

When comparing directories with the -b, -w, or -i options specified, diff first compares the files in
the same manner as cmp, then runs the diff algorithm if they are not equal. This may cause a small
amount of spurious output if the files are identical except for insignificant blank strings or
uppercase/lowercase differences.

The default algorithm requires memory allocation of roughly six times the size of the file. If sufficient
memory is not available for handling large files, the -h option or bdiff can be used (see bdiff(1)).

With other options if sufficient memory is not available, then either the swap or maxdsiz values can be

When run on directories with the -r option, diff recursively descends sub-trees. When comparing
deep multi-level directories, more memory may be required than is currently available on the system.
The amount of memory required depends on the depth of recursion and the size of the files.


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



used by -h option


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: SVID2, SVID3, XPG2, XPG3, XPG4, POSIX.2

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->