sdif - sdiff clone
SYNOPSIS
sdif [-n] [-l] [-s] [-[fF]] [-b] [-i] [-w] [-w width]
[-c[line]] [-diff=command] [file1 [file2]]
sdif [-rcs] [-q] [-rrev1 [-rrev2]] [sdif options] file
DESCRIPTION
Sdif is a clone of System V sdiff(1) command. The basic
feature of sdif and sdiff is making a side-by-side listing
of two different files. It makes much easier to compare
two files than looking at the normal diff output. All
contents of two files a listed on left and right sides.
Center column is used to indicate how different the line.
No mark means there is no difference. The line only
included in left file is indicated by `<' mark, and `>' is
used to lines only in right file. Modified line has a
mark `|'. Example output from sdif is like this:
1 deleted <
2 same 1 same
3 changed | 2 modified
4 same 3 same
> 4 added
Sdif has some incompatibilities with original sdiff. Neg-
ative incompatibility is a lack of -o option and expanding
all tabs to spaces. Other incompatibilities are:
o line numbering
o folding a long line
o context diff support
o unified diff support
o option to keep diff mark
o handle backspace and carriage return
o default width is 80
o rcs support
o cdif (word context diff) support
o read diff data from file or stdin
OPTIONS
-w width
Use width as a width of output listing. Default
width is 80. Original sdiff has a default value
130 but nobody uses 132 column line printer in
these days. If the standard error is to a termi-
nal, the width of that terminal is taken as a out-
put width if possible.
-l Print only left column if the line is identical.
diff output from file or stdin put this switch on
automatically.
-n Print line number on each lines.
-f Fold the line if it is longer than printing width.
Folded line is indicated by `+' mark at top of the
line. No continue mark is printed when numbering
option is on.
-F Fold longs line at word boundaries.
-m Usually diff mark from diff output are trimmed off.
This option forces to leave them on output listing.
I prefer to use this option with -c.
-rcs, -rrev
Use rcsdiff instead of normal diff. Option -rcs is
not required when -rrev is supplied.
-cdif Use cdif command instead of normal diff command.
-b, -w, -c, -u, -B
Passed through to the back-end diff command. Sdif
can process the output from context diff (-c) and
unified diff (-u) if those are available. These
are sometimes useful because you can get only modi-
fied part of text. Option -B is valid only for
cdif.
If you want to pass a option not listed here,
please use -diff="cdif ..." option.
-diff=command
Any command can be specified as a diff command to
be used. However piping output to sdif is usually
easier unless you want to get whole text.
-1, -2 Only old file is printed when option -1 is supplied
and only new file with -2 option. These are almost
useless with normal diff because ``sdif -1 A B'' is
equivalent to ``cat A'', but probably make some
sense with -cdif option.
RELATED COMMANDS
a2ps is a command which converts ascii text to
postscript program. C version was originally
posted to usenet by miguel@imag.imag.fr (Miguel
Santana). I reimplemented it by perl and enhanced
to use different font family for overstruck and
underlined characters. This is a convenient tool
to print the output from sdif to postscript
put and highlights deleted, changed and added word
on modified line. It uses overstiking to high-
lighting. Sdif can handle there sequence cor-
rectly. Cdif has to be installed to use -cdif
option with sdif.
Next is a example that I'm using often.
sdif -cdif -w180 file1 file2 | a2ps -w
All of these programs can be ftp'ed from ftp.sra.co.jp by
anonymous ftp from the directory pub/lang/perl/sra-
scripts.
AUTHOR
Kazumasa Utashiro <utashiro@iij.ad.jp>
Internet Initiative Japan Inc.
3-13 Kanda Nishiki-cho, Chiyoda-ku, Tokyo 101, Japan
SEE ALSO
perl(1), diff(1), cdif(1), a2ps(1)
Man(1) output converted with
man2html