1Fsdb::Filter::dbfilealtUesre(r3)Contributed Perl DocumenFtsadtbi:o:nFilter::dbfilealter(3)
2
3
4
6 dbfilealter - alter the format of an Fsdb file, changing the row/column
7 separator
8
10 dbfilealter [-c] [-F fs] [-R rs] [-Z compression] [column...]
11
13 This program reformats a Fsdb file, altering the row ("-R rs") or
14 column ("-F fs") separator. It verifies that this action does not
15 violate the file constraints (for example, if spaces appear in data and
16 the new format has space as a separator), and optionally corrects
17 things.
18
19 With "-Z compression" it controls compression on the file
20
22 -F or --fs or --fieldseparator S
23 Specify the field (column) separator as "S". See below for valid
24 field separators.
25
26 -R or --rs or --rowseparator S
27 Specify the row separator as "S". See below for valid row
28 separators.
29
30 -Z or --compression S
31 Specify file compression as given by file extension "S". Supported
32 compressions are gz for gzip, bz2 for bzip2, xz for xz, or "none"
33 or undef to disable compression. Default is none.
34
35 -c or --correct
36 Correct any inconsistency caused by the new separators, if
37 possible.
38
39 This module also supports the standard fsdb options:
40
41 -d Enable debugging output.
42
43 -i or --input InputSource
44 Read from InputSource, typically a file name, or "-" for standard
45 input, or (if in Perl) a IO::Handle, Fsdb::IO or Fsdb::BoundedQueue
46 objects.
47
48 -o or --output OutputDestination
49 Write to OutputDestination, typically a file name, or "-" for
50 standard output, or (if in Perl) a IO::Handle, Fsdb::IO or
51 Fsdb::BoundedQueue objects.
52
53 --autorun or --noautorun
54 By default, programs process automatically, but Fsdb::Filter
55 objects in Perl do not run until you invoke the run() method. The
56 "--(no)autorun" option controls that behavior within Perl.
57
58 --help
59 Show help.
60
61 --man
62 Show full manual.
63
64 Valid Field Separators
65 D default: any amount of whitespace on input, tabs on output.
66 s single space (exactly one space for input and output).
67 S double space on output; two or more spaces on input.
68 t single tab character (exactly one tab for input and output).
69 XN take N as one or more hex digits that specify a unicode character.
70 Accept one or more of those characters on input, output exactly one of
71 those characters.
72 CA take A as a one (unicode) literal character. Accept one or more of
73 those characters on input, output exactly one of those characters.
74
75 Potentially in the future "xN" and "cA" will support single-character-
76 on-input equivalents of "XN" and <CA>.
77
78 Valid Row Seperators
79 Three row separators are allowed:
80
81 D the default, one line per row
82 C complete rowized. Each line is a field-labeled and its value, and a
83 blank line separates "rows". All fields present in the output.
84 I incompletely rowized. Like "C", but null fields are omitted from the
85 output.
86
88 Input:
89 #fsdb name id test1
90 a 1 80
91 b 2 70
92 c 3 65
93
94 Command:
95 cat data.fsdb | dbfilealter -F S
96
97 Output:
98 #fsdb -F S name id test1
99 a 1 80
100 b 2 70
101 c 3 65
102 # | dbfilealter -F S
103
104 Command 2:
105 cat data.fsdb | dbfilealter -R C
106
107 Output:
108 #fsdb -R C name id test1
109 name: a
110 id: 1
111 test1: 80
112
113 name: b
114 id: 2
115 test1: 70
116
117 name: c
118 id: 3
119 test1: 65
120
121 # | dbfilealter -R C
122
123 Correction mode input:
124 #fsdb -F S name id test1
125 a student 1 80
126 b nice 2 70
127 c all 3 65
128
129 Correction mode command:
130 cat correction.fsdb | dbfilealter -c -F D
131
132 Correction mode output:
133 #fsdb name id test1
134 a_student 1 80
135 b_nice 2 70
136 c_all 3 65
137 # | dbfilealter -c -F D
138
140 Fsdb, dbcoldefine.
141
143 new
144 $filter = new Fsdb::Filter::dbfilealter(@arguments);
145
146 Create a new dbfilealter object, taking command-line arguments.
147
148 set_defaults
149 $filter->set_defaults();
150
151 Internal: set up defaults.
152
153 parse_options
154 $filter->parse_options(@ARGV);
155
156 Internal: parse command-line arguments.
157
158 setup
159 $filter->setup();
160
161 Internal: setup, parse headers.
162
163 run
164 $filter->run();
165
166 Internal: run over each rows.
167
169 Copyright (C) 2008-2018 by John Heidemann <johnh@isi.edu>
170
171 This program is distributed under terms of the GNU general public
172 license, version 2. See the file COPYING with the distribution for
173 details.
174
175
176
177perl v5.28.1 2018-02-17 Fsdb::Filter::dbfilealter(3)