Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
fcomp(1)		    General Commands Manual		      fcomp(1)

       fcomp - file compare

       fcomp [ option...  ] filename1 filename2

       fcomp -Help

       fcomp -VERSion

       The fcomp program is used to compare text files,	similar	to the diff(1)
       program.	 Its advantage is that it always produces minimal differences,
       and  so	will never mis-sync when comparing files.  Its disadvantage is
       that it runs slower due to the extra work required to  produce  optimal
       differences.   However, for files differing by less than	a few thousand
       lines, its performance is adequate.  The	algorithms used	by this	 util-
       ity  are	also used by the fhist(1) program in order to produce the edit

       To compare file old to file new,	the command:
	      fcomp old	new
       would be	used.  This gives the differences involved in converting  from
       file  old  to file new.	This is	analogous to the use of	the cp(1) com-
       mand.  Either the old or	new file may be	a directory, in	which case the
       comparison  is  done to the file	in the directory with the same name as
       the other file.	An error is given if old and new are both directories.

       The following options are understood:

       -BINary This option may be used to compare binary files on a  byte-for-
	       byte  basis.   (Each  byte  is treated as a "line" by the algo-
	       rithm.)	Byte values are	displayed in hexadecimal, as  are  the
	       addresses.   Note:  this	is different behaviour to the fhist(1)
	       option of the same name.

	       This option may be used to avoid	 comparing  binary  files.   A
	       warnign will be prointed	on the standard	error, but the program
	       will report success without printing andy other output.

	       Ignore blank lines in the input files.

       -Context	number
	       This specifies the number of lines of "context" which  is  dis-
	       played.	 This  shows  the specified number of lines before and
	       after the actual	lines being changed.  This is useful to	locate
	       and  identify  the  line	 which is actually being changed, when
	       there are many identical	copies of the line in the file.

	       Output an edit script which is machine readable.

       -Failures number
	       This stops the comparison if the	number of changes exceeds  the
	       specified  number.  Each	change is a delete or insert of	a sin-
	       gle line.  This is useful when you are not  interested  in  the
	       results when the	files are totally different.  Another use is a
	       quick check to see if two files are identical, by using a value
	       of zero.

       -Join number
	       This merges together lines which	have changed, if they are sep-
	       arated by up to the specified number of unchanged lines.	  This
	       makes a change look bigger, but reduces the "choppiness"	of the
	       output by showing fewer regions being changed.  This is partic-
	       ularly  effective  to  suppress	worthless  matchings of	single
	       blank lines or comment beginning	and ending  lines.   A	useful
	       value for this option is	3 or so.

	       Output matching lines, rather then changed lines.

	       This  outputs  the line numbers at the left edge	of the output.
	       This isn't normally needed, since the  line  numbers  are  dis-
	       played in the comment line preceding the	lines being displayed.
	       Not outputting the line	numbers	 prevents  the	terminal  from
	       needlessly scrolling for	long lines.

       -Output filename
	       Send the	output to this file, rather than the standard output.

	       Output only a quick summary of changes needed.

	       This  option ignores differences	in the number of spaces	in the
	       two lines.  That	is, two	or more	adjacent spaces	are handled as
	       a  single  space.  Spaces at the	beginning or end of a line are
	       totally ignored.

	       Uppercase lines before comparing.

	       This outputs all	of both	files together,	showing	what  happened
	       to  each	 line of the first file	in order to change to the line
	       in the second file.  This output	is  in	"change	 bar"  format,
	       where  inserted	lines  begin with |+, deleted lines begin with
	       |-, and unchanged lines begin with spaces.  The presence	of the
	       vertical	bar makes it easy to search for	the changed lines.

Reference Manual		     FHist			      fcomp(1)


Want to link to this manual page? Use this URL:

home | help