rwcompare - Compare the records in two SiLK Flow files


  rwcompare [--quiet] [--site-config-file] FILE1 FILE2

  rwcompare --help

  rwcompare --version


rwcompare opens the two files named on the command and compares the SiLK Flow records they contain. If the records are identical, rwcompare exits with status 0. If any of the records differ, rwcompare prints a message and exits with status 1. If there is an issue reading either file, an error is printed and the exit status is 2. Use the --quiet switch to suppress all output (error messages included). You may use - or stdin for one of the file names, in which case rwcompare reads from the standard input.


Option names may be abbreviated if the abbreviation is unique or is an exact match for an option. A parameter to an option may be specified as --arg=param or --arg param, though the first form is required for options that take optional parameters.


Do not print a message if the files differ, and do not an print error message if a file cannot be opened or read.


Read the SiLK site configuration from the named file FILENAME. When this switch is not provided, rwcombine searches for the site configuration file in the locations specified in the "FILES" section.


Print the available options and exit.


Print the version number and information about how SiLK was configured, then exit the application.


In the following examples, the dollar sign ($) represents the shell prompt. Some input lines are split over multiple lines in order to improve readability, and a backslash (\) is used to indicate such lines. The examples assume the existence of the file that contains SiLK Flow records. The exit status of the most recent command is available in the shell variable $?.

Compare a file with itself:

 $ rwcompare
 $ echo $?

Compare a file with itself, where one instance of the file is read from the standard input:

 $ rwcat | rwcompare -
 $ echo $?

Use rwsort(1) to modify one instance of the file and compare the results:

 $ rwsort --fields=proto | rwcompare -
 - differ: record 1
 $ echo $?

Run the command again and use the --quiet switch:

 $ rwsort --fields=proto | rwcompare --quiet -
 $ echo $?

Compare the file with input containing two copies of the file:

 $ rwcat | rwcompare - - differ: EOF
 $ echo $?

Compare the file with /dev/null:

 $ rwcompare --quiet /dev/null
 $ echo $?

rwcompare checks whether two files have the same records in the same order. To compare two arbitrary files, use rwsort(1) to reorder the records. Make certain to provide enough fields to the rwsort command so that the records are in the same order.

 $ rwsort --fields=1-10,12-15,20-29 > /tmp/
 $ rwsort --fields=1-10,12-15,20-29   \
   | rwcompare /tmp/ -
 /tmp/ - differ: record 103363



This environment variable is used as the value for the --site-config-file when that switch is not provided.


This environment variable specifies the root directory of data repository. As described in the "FILES" section, rwcombine may use this environment variable when searching for the SiLK site configuration file.


This environment variable gives the root of the install tree. When searching for configuration files, rwcombine may use this environment variable. See the "FILES" section for details.



Possible locations for the SiLK site configuration file which are checked when the --site-config-file switch is not provided.


rwfileinfo(1), rwcat(1), rwsort(1), silk(7)