Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ bdiff(1) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cmp(1)

comm(1)

diff(1)

diff3(1)

ed(1)

bdiff(1)                                                           bdiff(1)

NAME
     bdiff - compare large files (big diff)

SYNOPSIS
     bdiff file1 file2 [n] [-s]

DESCRIPTION
     bdiff compares two files in a manner analogous to diff(1), but it can
     handle files that are too large for diff.

     The output from bdiff (as with diff) consists of:

     -  the lines in which the specified files differ,

     -  the ed commands required to convert file1 into file2 [see ed(1)].

OPTIONS
     The arguments and options must appear in the above order.

     file1 file2
          file1 and file2 are the names of the files that you want to com-
          pare. If you use a dash (-) instead of a file name, bdiff reads
          from standard input.

     n    In n you can specify how many lines each segment is to have when
          bdiff divides the files.

          n is an integer greater than 0.

          n not specified: n = 3500

     -s   Some bdiff error messages are suppressed. This does not, however,
          suppress error messages issued by diff. This option is primarily
          used in shell scripts.

     Caution:
          If option -s is specified in addition to a value for n, the
          correct order must be observed: n must come before -s.

   Functionality

     bdiff ignores lines common to the beginning of both files. Starting
     with the first line in which the files differ, bdiff divides the
     specified files into n-line segments. The default value for n is 3500,
     but you can change this value when you call bdiff (see option n).
     bdiff invokes diff. diff then compares the corresponding segments. You
     should therefore choose a value for n which will not create segments
     too large for diff to handle.







Page 1                       Reliant UNIX 5.44                Printed 11/98

bdiff(1)                                                           bdiff(1)

     bdiff can only find differences between segments with corresponding
     segment numbers: it does not, for example, compare segment 4 of file1
     with segment 5 of file2. bdiff thus often gives a more complicated
     picture of the differences than you might wish.

     Despite the subdivision into segments, output line numbering is con-
     secutive from the beginning to the end of the files. The files thus
     appear to be have been processed whole.

EXAMPLES
     This example is intended to demonstrate the effect of dividing the
     files into segments. First a file abc1 with 26 lines is created. Each
     line has a consecutive lowercase letter of the alphabet in column 1;
     thus, a is in line 1, z in line 26. This file is then copied to the
     file abc2, and a new line with the digit 0 in column one is inserted
     before the first line of abc2. The two files are then compared in 5-
     line segments.

     $ bdiff abc1 abc2 5
     0a1
     > 0
     5d5
     < e
     5a6
     > e
     10d10
     < j
     10a11
     > j
     15d15
     < o
     15a16
     > o
     20d20
     < t
     20a21
     > t
     25d25
     < y
     25a26
     > y

     To start with, the first 5 lines of the two files are compared. The
     following actions are required to make the first 5 lines of abc1 and
     abc2 match:

     -  The first line of abc2 (digit 0) must be inserted before the first
        line of abc1. bdiff prints the ed command that you need to do this:
        0a1.

        (This ed command actually inserts line 1 of abc2 after line 0 of
        abc1).


Page 2                       Reliant UNIX 5.44                Printed 11/98

bdiff(1)                                                           bdiff(1)

     -  The fifth line of abc1 contains the letter e and must be deleted,
        since abc2 does not include any lines with the letter e in its
        first 5 lines: 5d5.

     Lines 6 - 10 of the two files are compared next. Line 6 of abc2
     (letter e) must now be inserted before line 6 of abc1 (letter f), and
     line 10 of abc1 must be deleted. The segments will then be identical.

     Since bdiff compares files in segments, its output is generally more
     complicated than that of diff. In effect, inserting the first line of
     abc2 before the first line of abc1 would have been sufficient.

SEE ALSO
     cmp(1), comm(1), diff(1), diff3(1), ed(1).








































Page 3                       Reliant UNIX 5.44                Printed 11/98

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