Next: , Previous: Scat, Up: Data Manipulation Commands

29.2.5 numdiff — Difference Based on Numbers

numdiff is used to compare two text files which contain numbers. The files must have the same number of lines, and must have the same structure for this command to work. The command line syntax is

     numdiff file1 file2

Neither file may be specified as a hyphen (`-') — explicit names must be used. numdiff reads a line from each file, translates all punctuation to spaces, and then read each word on the line. An attempt is made to convert each word to a floating point number, and the minimum of the absolute and relative difference in magnitude is computed. If this number is larger than 0.01, then a message is printed and the two offending lines are displayed, otherwise, the difference is used to calculate the maximum difference over the entire pair of files. Large differences are not used in the calculation of the maximum, so differences in dates and CPU times will usually not affect the results. Messages are printed if numbers are not found in equivalent positions or if the number of words in a line do not match.