1Fsdb::Filter::dbfiledifUfs(e3r)Contributed Perl DocumentFastdibo:n:Filter::dbfilediff(3)
2
3
4
6 dbfilediff - compare two fsdb tables
7
9 dbfilediff [-Eq] [-N diff_column_name] --input table1.fsdb --input table2.fsdb
10
11 OR
12
13 cat table1.fsdb | dbfilediff [-sq] --input table2.fsdb
14
16 Dbfilediff compares two Fsdb tables, row by row. Unlike Unix diff(1),
17 this program assumes the files are identical line-by-line and we
18 compare fields. Thus, insertion of one extra row will result in all
19 subsequent lines being marked different.
20
21 By default, all columns must be unique. (At some point, support to
22 specific specific columns may be added.)
23
24 Output is a new table with a new column "diff" (or something else if
25 the "-N" option is given), "-" and "+" for the first and second non-
26 equal rows, "=" for matching lines, or "~" if they are equal with
27 epsilon numerics (in which case only the second row is included).
28 Unlike Unix diff(1), we output all rows (the "=" lines), not just diffs
29 (the "--quiet" option suppresses this output).
30
31 Optionally, with "-E" it will do a "epsilon numeric" comparision, to
32 account for things like variations in different computer's floating
33 point precision and differences in printf output.
34
35 Epsilon comparision is asymmetric, in that it assumes the first input
36 is correct an allows the second input to vary, but not the reverse.
37
38 Because two tables are required, input is typically in files. Standard
39 input is accessible by the file "-".
40
42 -E or --epsilon
43 Do epsilon-numeric comparison. (Described above.)
44
45 Epsilon-comparision is only done on columns that look like floating
46 point numbers, not on strings or integers. Epsilon comparision
47 allows the last digit to vary by 1, or for there to be one extra
48 digit of precision, but only for floating point numbers.
49
50 Rows that are within epsilon are not considered different for
51 purposes of the exit code.
52
53 --exit
54 Exit with a status of 1 if some differences were found. (By
55 default, the exit status is 0 with or without differences if the
56 file is processed successfully.)
57
58 -N on --new-name
59 Specify the name of the "diff" column, if any. (Default is
60 "diff".)
61
62 -q or --quiet
63 Be quiet, suppressing output for identical rows. (This behavior is
64 different from Unix diff(1) where "-q" suppresses all output.) If
65 repeated, omits epsilon-equivalent rows.
66
67 This module also supports the standard fsdb options:
68
69 -d Enable debugging output.
70
71 -i or --input InputSource
72 Read from InputSource, typically a file name, or "-" for standard
73 input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue
74 objects.
75
76 -o or --output OutputDestination
77 Write to OutputDestination, typically a file name, or "-" for
78 standard output, or (if in Perl) a IO::Handle, Fsdb::IO or
79 Fsdb::BoundedQueue objects.
80
81 --autorun or --noautorun
82 By default, programs process automatically, but Fsdb::Filter
83 objects in Perl do not run until you invoke the run() method. The
84 "--(no)autorun" option controls that behavior within Perl.
85
86 --help
87 Show help.
88
89 --man
90 Show full manual.
91
93 Input:
94 #fsdb event clock absdiff pctdiff
95 _null_getpage+128 815812813.281756 0 0
96 _null_getpage+128 815812813.328709 0.046953 5.7554e-09
97 _null_getpage+128 815812813.353830 0.025121 3.0793e-09
98 _null_getpage+128 815812813.357169 0.0033391 4.0929e-10
99
100 And in the file TEST/dbfilediff_ex.in-2:
101
102 #fsdb event clock absdiff pctdiff
103 _null_getpage+128 815812813.281756 0 0
104 _null_getpage+128 815812813.328709 0.046953 5.7554e-09
105 _null_getpage+128 815812813.353830 0.025121 3.0793e-09
106 _null_getpage+128 815812813.357169 0.003339 4.0929e-10
107
108 Command:
109 cat TEST/dbfilediff_ex.in | dbfilediff -i - -i TEST/dbfilediff_ex.in-2
110
111 Output:
112 #fsdb event clock absdiff pctdiff diff
113 _null_getpage+128 815812813.281756 0 0 =
114 _null_getpage+128 815812813.328709 0.046953 5.7554e-09 =
115 _null_getpage+128 815812813.353830 0.025121 3.0793e-09 =
116 _null_getpage+128 815812813.357169 0.0033391 4.0929e-10 -
117 _null_getpage+128 815812813.357169 0.003339 4.0929e-10 +
118 # | dbfilediff --input TEST/dbfilediff_ex.in-2
119
120 By comparision, if one adds the "-s" option, then all rows will pass as
121 equal.
122
124 Fsdb. dbrowuniq. dbfilediff.
125
126 dbrowdiff, dbrowuniq, and dbfilediff are similar but different.
127 dbrowdiff computes row-by-row differences for a column, dbrowuniq
128 eliminates rows that have no differences, and dbfilediff compares
129 fields of two files.
130
132 new
133 $filter = new Fsdb::Filter::dbfilediff(@arguments);
134
135 Create a new dbfilediff object, taking command-line arguments.
136
137 set_defaults
138 $filter->set_defaults();
139
140 Internal: set up defaults.
141
142 parse_options
143 $filter->parse_options(@ARGV);
144
145 Internal: parse command-line arguments.
146
147 setup
148 $filter->setup();
149
150 Internal: setup, parse headers.
151
152 _find_epsilon
153 ($value, $epsilon, $sig_figs) = _find_epsilon($fp)
154
155 Return a numeric VALUE and an EPSILON that reflects its significant
156 figures with possible rounding error.
157
158 run
159 $filter->run();
160
161 Internal: run over each row.
162
164 Copyright (C) 2012-2018 by John Heidemann <johnh@isi.edu>
165
166 This program is distributed under terms of the GNU general public
167 license, version 2. See the file COPYING with the distribution for
168 details.
169
170
171
172perl v5.36.0 2023-01-20 Fsdb::Filter::dbfilediff(3)