sycsvpro 0.1.11 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/bin/sycsvpro +33 -1
- data/lib/sycsvpro.rb +1 -0
- data/lib/sycsvpro/version.rb +1 -1
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/bin/sycsvpro
CHANGED
@@ -89,6 +89,38 @@ command :extract do |c|
|
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
92
|
+
desc 'Remove duplicate rows from a file. Duplicates are identified by key '+
|
93
|
+
'columns'
|
94
|
+
command :unique do |c|
|
95
|
+
c.desc 'Rows to consider'
|
96
|
+
c.arg_name '1,2,10-30,45-EOF,REGEXP,BEGINlogical_expressionEND'
|
97
|
+
c.flag [:r, :row], :must_match => row_regex
|
98
|
+
|
99
|
+
c.desc 'Columns to extract'
|
100
|
+
c.arg_name '1,2,10-30'
|
101
|
+
c.flag [:c, :col], :must_match => /\d+(?:,\d+|-\d+)*/
|
102
|
+
|
103
|
+
c.desc 'Key columns to check for duplication'
|
104
|
+
c.arg_name '0,1-4'
|
105
|
+
c.flag [:k, :key]
|
106
|
+
|
107
|
+
c.desc 'Format of date values'
|
108
|
+
c.arg_name '%d.%m.%Y|%m/%d/%Y|...'
|
109
|
+
c.flag [:df]
|
110
|
+
|
111
|
+
c.action do |global_options,options,args|
|
112
|
+
print "Removing duplicates ..."
|
113
|
+
unique = Sycsvpro::Unique.new(infile: global_options[:f],
|
114
|
+
outfile: global_options[:o],
|
115
|
+
rows: options[:r],
|
116
|
+
cols: options[:c],
|
117
|
+
key: options[:k],
|
118
|
+
df: options[:df])
|
119
|
+
unique.execute
|
120
|
+
puts "done"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
92
124
|
desc 'Collect values of specified rows and columns from the file and group '+
|
93
125
|
'them in categories'
|
94
126
|
command :collect do |c|
|
@@ -411,6 +443,7 @@ command :join do |c|
|
|
411
443
|
c.flag [:i, :insert]
|
412
444
|
|
413
445
|
c.action do |global_options,options,args|
|
446
|
+
print 'Joining...'
|
414
447
|
join = Sycsvpro::Join.new(infile: global_options[:f],
|
415
448
|
outfile: global_options[:o],
|
416
449
|
source: args[0],
|
@@ -421,7 +454,6 @@ command :join do |c|
|
|
421
454
|
headerless: options[:headerless],
|
422
455
|
header: options[:h],
|
423
456
|
insert_header: options[:i])
|
424
|
-
print 'Joining...'
|
425
457
|
join.execute
|
426
458
|
print 'done'
|
427
459
|
end
|
data/lib/sycsvpro.rb
CHANGED
data/lib/sycsvpro/version.rb
CHANGED