1DBROWUNIQ(1)          User Contributed Perl Documentation         DBROWUNIQ(1)
2
3
4

NAME

6       dbrowuniq - eliminate adjacent rows with duplicate fields, maybe
7       counting
8

SYNOPSIS

10       dbrowuniq [-cFLB] [uniquifying fields...]
11

DESCRIPTION

13       Eliminate adjacent rows with duplicate fields, perhaps counting them.
14       Roughly equivalent to the Unix uniq command, but optionally only
15       operating on the specified fields.
16
17       By default, all columns must be unique.  If column names are specified,
18       only those columns must be unique and the first row with those columns
19       is returned.
20
21       Dbrowuniq eliminates only identical rows that adjacent.  If you want to
22       eliminate identical rows across the entirefile, you must make them
23       adajcent, perhaps by using dbsort on your uniquifying field.  (That is,
24       the input with three lines a/b/a will produce three lines of output
25       with both a's, but if you dbsort it, it will become a/a/b and dbrowuniq
26       will output a/b.
27
28       By default, dbrowuniq outputs the first unique row.  Optionally, with
29       "-L", it will output the last unique row, or with "-B" it outputs both
30       first and last.  (This choice only matters when uniqueness is
31       determined by specific fields.)
32
33       dbrowuniq can also count how many unique, adjacent lines it finds with
34       "-c", with the count going to a new column (defaulting to "count").
35       Incremental counting, when the "count" column already exists, is
36       possible with "-I".  With incremental counting, the existing count
37       column is summed.
38

OPTIONS

40       -c or --count
41           Create a new column (count) which counts the number of times each
42           line occurred.
43
44           The new column is named by the "-N" argument, defaulting to
45           "count".
46
47       -N on --new-name
48           Specify the name of the count column, if any.  (Default is
49           "count".)
50
51       -I on --incremental
52           Incremental counting.  If the count column exists, it is assumed to
53           have a partial count and the count accumulates.  If the count
54           column doesn't exist, it is created.
55
56       -L or --last
57           Output the last unique row only.  By default, it outputs the first
58           unique row.
59
60       -F or --first
61           Output the first unique row only.  (This output is the default.)
62
63       -B or --both
64           Output both the first and last unique rows.
65
66       This module also supports the standard fsdb options:
67
68       -d  Enable debugging output.
69
70       -i or --input InputSource
71           Read from InputSource, typically a file name, or "-" for standard
72           input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue
73           objects.
74
75       -o or --output OutputDestination
76           Write to OutputDestination, typically a file name, or "-" for
77           standard output, or (if in Perl) a IO::Handle, Fsdb::IO or
78           Fsdb::BoundedQueue objects.
79
80       --autorun or --noautorun
81           By default, programs process automatically, but Fsdb::Filter
82           objects in Perl do not run until you invoke the run() method.  The
83           "--(no)autorun" option controls that behavior within Perl.
84
85       --header H
86           Use H as the full Fsdb header, rather than reading a header from
87           then input.
88
89       --help
90           Show help.
91
92       --man
93           Show full manual.
94

SAMPLE USAGE

96   Input:
97           #fsdb      event
98           _null_getpage+128
99           _null_getpage+128
100           _null_getpage+128
101           _null_getpage+128
102           _null_getpage+128
103           _null_getpage+128
104           _null_getpage+4
105           _null_getpage+4
106           _null_getpage+4
107           _null_getpage+4
108           _null_getpage+4
109           _null_getpage+4
110           #  | /home/johnh/BIN/DB/dbcol event
111           #  | /home/johnh/BIN/DB/dbsort event
112
113   Command:
114           cat data.fsdb | dbrowuniq -c
115
116   Output:
117           #fsdb       event   count
118           _null_getpage+128   6
119           _null_getpage+4     6
120           #   2       /home/johnh/BIN/DB/dbcol        event
121           #  | /home/johnh/BIN/DB/dbrowuniq -c
122

SAMPLE USAGE 2

124       Retaining the last unique row as an example.
125
126   Input:
127               #fsdb event i
128               _null_getpage+128 10
129               _null_getpage+128 11
130               _null_getpage+128 12
131               _null_getpage+128 13
132               _null_getpage+128 14
133               _null_getpage+128 15
134               _null_getpage+4 16
135               _null_getpage+4 17
136               _null_getpage+4 18
137               _null_getpage+4 19
138               _null_getpage+4 20
139               _null_getpage+4 21
140               #  | /home/johnh/BIN/DB/dbcol event
141               #  | /home/johnh/BIN/DB/dbsort event
142
143   Command:
144           cat data.fsdb | dbrowuniq -c -L event
145
146   Output:
147               #fsdb event i count
148               _null_getpage+128       15      6
149               #  | /home/johnh/BIN/DB/dbcol event
150               #  | /home/johnh/BIN/DB/dbsort event
151               _null_getpage+4 21      6
152               #   | dbrowuniq -c
153

SAMPLE USAGE 3

155       Incremental counting.
156
157   Input:
158           #fsdb       event   count
159           _null_getpage+128   6
160           _null_getpage+128   6
161           _null_getpage+4     6
162           _null_getpage+4     6
163           #  /home/johnh/BIN/DB/dbcol event
164           #  | /home/johnh/BIN/DB/dbrowuniq -c
165
166   Command:
167           cat data.fsdb | dbrowuniq -I -c event
168
169   Output:
170               #fsdb event count
171               _null_getpage+128   12
172               _null_getpage+4     12
173               #  /home/johnh/BIN/DB/dbcol     event
174               #  | /home/johnh/BIN/DB/dbrowuniq -c
175               #   | dbrowuniq -I -c event
176

SEE ALSO

178       Fsdb.
179
181       Copyright (C) 1997-2018 by John Heidemann <johnh@isi.edu>
182
183       This program is distributed under terms of the GNU general public
184       license, version 2.  See the file COPYING with the distribution for
185       details.
186
187
188
189perl v5.28.1                      2018-12-21                      DBROWUNIQ(1)
Impressum