tb 0.8 → 0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README +14 -7
- data/bin/tb +3 -3
- data/lib/tb.rb +3 -3
- data/lib/tb/basic.rb +34 -34
- data/lib/tb/catreader.rb +3 -3
- data/lib/tb/cmd_cat.rb +5 -5
- data/lib/tb/cmd_consecutive.rb +4 -4
- data/lib/tb/cmd_crop.rb +4 -4
- data/lib/tb/cmd_cross.rb +3 -3
- data/lib/tb/cmd_cut.rb +3 -3
- data/lib/tb/cmd_git.rb +3 -3
- data/lib/tb/cmd_grep.rb +3 -3
- data/lib/tb/cmd_group.rb +3 -3
- data/lib/tb/cmd_gsub.rb +3 -3
- data/lib/tb/cmd_help.rb +3 -3
- data/lib/tb/cmd_join.rb +3 -3
- data/lib/tb/cmd_ls.rb +3 -3
- data/lib/tb/cmd_melt.rb +3 -3
- data/lib/tb/cmd_mheader.rb +3 -3
- data/lib/tb/cmd_nest.rb +3 -3
- data/lib/tb/cmd_newfield.rb +17 -7
- data/lib/tb/cmd_rename.rb +3 -3
- data/lib/tb/cmd_shape.rb +3 -3
- data/lib/tb/cmd_sort.rb +3 -3
- data/lib/tb/cmd_svn.rb +3 -3
- data/lib/tb/cmd_tar.rb +3 -3
- data/lib/tb/cmd_to_csv.rb +4 -4
- data/lib/tb/cmd_to_json.rb +3 -3
- data/lib/tb/cmd_to_ltsv.rb +4 -4
- data/lib/tb/cmd_to_pnm.rb +3 -3
- data/lib/tb/cmd_to_pp.rb +3 -3
- data/lib/tb/cmd_to_tsv.rb +4 -4
- data/lib/tb/cmd_to_yaml.rb +3 -3
- data/lib/tb/cmd_unmelt.rb +3 -3
- data/lib/tb/cmd_unnest.rb +5 -4
- data/lib/tb/cmdmain.rb +3 -3
- data/lib/tb/cmdtop.rb +3 -3
- data/lib/tb/cmdutil.rb +3 -3
- data/lib/tb/csv.rb +10 -4
- data/lib/tb/customcmp.rb +3 -3
- data/lib/tb/customeq.rb +3 -3
- data/lib/tb/enumerable.rb +3 -3
- data/lib/tb/enumerator.rb +3 -3
- data/lib/tb/ex_enumerable.rb +2 -2
- data/lib/tb/ex_enumerator.rb +4 -4
- data/lib/tb/fieldset.rb +3 -3
- data/lib/tb/fileenumerator.rb +6 -6
- data/lib/tb/func.rb +3 -3
- data/lib/tb/json.rb +3 -3
- data/lib/tb/ltsv.rb +32 -7
- data/lib/tb/pnm.rb +3 -3
- data/lib/tb/reader.rb +3 -3
- data/lib/tb/record.rb +3 -3
- data/lib/tb/revcmp.rb +3 -3
- data/lib/tb/ropen.rb +23 -23
- data/lib/tb/search.rb +7 -7
- data/lib/tb/tsv.rb +3 -3
- data/lib/tb/zipper.rb +3 -3
- data/sample/excel2csv +36 -36
- data/sample/poi-xls2csv.rb +78 -78
- data/sample/poi-xls2csv.sh +3 -3
- data/sample/tbplot +214 -112
- data/test/test_basic.rb +4 -4
- data/test/test_cmd_newfield.rb +17 -3
- data/test/test_ex_enumerable.rb +18 -18
- data/test/test_ltsv.rb +8 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b5601329ad0755149e198c2139d3da0707fb0af
|
4
|
+
data.tar.gz: 03997adcba0d54d8745235e6534d899ba23100ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59b8dea2fba883302eb50b2253c74c0e963ad408cf9031a908ee6957b91f0562f1c6ee93249e68ca13ed49d4144ddce863cfd381cba2e9c693801616791593e7
|
7
|
+
data.tar.gz: ef49a9b3f97c8490303bf50812b590b38c56fa6c8b045bf136f032debd5a8070cbf10e28e092699578a3aac442c50b7128d8ed37f4d8e24ecee5a7b74cc72a93
|
data/README
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= tb - manipulation tool for table: CSV, TSV, JSON, etc.
|
1
|
+
= tb - manipulation tool for table: CSV, TSV, JSON, LTSV, etc.
|
2
2
|
|
3
3
|
tb provides a command and a library for manipulating tables:
|
4
4
|
Unix filter like operations (grep, sort, cat, cut, ls, etc.),
|
@@ -133,6 +133,7 @@ There are more subcommands.
|
|
133
133
|
tb help [OPTS] [SUBCOMMAND]
|
134
134
|
tb to-csv [OPTS] [TABLE ...]
|
135
135
|
tb to-tsv [OPTS] [TABLE]
|
136
|
+
tb to-ltsv [OPTS] [TABLE]
|
136
137
|
tb to-pnm [OPTS] [TABLE]
|
137
138
|
tb to-json [OPTS] [TABLE]
|
138
139
|
tb to-yaml [OPTS] [TABLE]
|
@@ -142,7 +143,7 @@ There are more subcommands.
|
|
142
143
|
tb sort [OPTS] [TABLE]
|
143
144
|
tb cut [OPTS] FIELD,... [TABLE]
|
144
145
|
tb rename [OPTS] SRC,DST,... [TABLE]
|
145
|
-
tb newfield [OPTS] FIELD
|
146
|
+
tb newfield [OPTS] FIELD VALUE [TABLE]
|
146
147
|
tb cat [OPTS] [TABLE ...]
|
147
148
|
tb join [OPTS] [TABLE1 TABLE2 ...]
|
148
149
|
tb consecutive [OPTS] [TABLE ...]
|
@@ -164,8 +165,9 @@ tb help -s shows one line summary of the subcommands.
|
|
164
165
|
|
165
166
|
% tb help -s
|
166
167
|
help : Show help message of tb command.
|
167
|
-
to-csv : Convert a table to CSV (Comma Separated
|
168
|
-
to-tsv : Convert a table to TSV (Tab Separated
|
168
|
+
to-csv : Convert a table to CSV (Comma Separated Values).
|
169
|
+
to-tsv : Convert a table to TSV (Tab Separated Values).
|
170
|
+
to-ltsv : Convert a table to LTSV (Labeled Tab Separated Values).
|
169
171
|
to-pnm : Convert a table to PNM (Portable Anymap: PPM, PGM, PBM).
|
170
172
|
to-json : Convert a table to JSON (JavaScript Object Notation).
|
171
173
|
to-yaml : Convert a table to YAML (YAML Ain't a Markup Language).
|
@@ -189,14 +191,19 @@ tb help -s shows one line summary of the subcommands.
|
|
189
191
|
mheader : Collapse multi rows header.
|
190
192
|
crop : Extract rectangle in a table.
|
191
193
|
ls : List directory entries as a table.
|
192
|
-
tar
|
193
|
-
svn
|
194
|
-
git
|
194
|
+
tar : Show the file listing of tar file.
|
195
|
+
svn : Show the SVN log as a table.
|
196
|
+
git : Show the GIT log as a table.
|
195
197
|
|
196
198
|
== Install
|
197
199
|
|
198
200
|
gem install tb
|
199
201
|
|
202
|
+
== Run without gem
|
203
|
+
|
204
|
+
git clone https://github.com/akr/tb.git
|
205
|
+
ruby -Itb/lib tb/bin/tb help
|
206
|
+
|
200
207
|
== Links
|
201
208
|
|
202
209
|
* ((<source repository on github|URL:https://github.com/akr/tb>))
|
data/bin/tb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
#
|
3
3
|
# Copyright (C) 2011 Tanaka Akira <akr@fsij.org>
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without
|
6
6
|
# modification, are permitted provided that the following conditions
|
7
7
|
# are met:
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# 1. Redistributions of source code must retain the above copyright
|
10
10
|
# notice, this list of conditions and the following disclaimer.
|
11
11
|
# 2. Redistributions in binary form must reproduce the above
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# 3. The name of the author may not be used to endorse or promote
|
16
16
|
# products derived from this software without specific prior
|
17
17
|
# written permission.
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
20
20
|
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
21
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
data/lib/tb.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# lib/tb.rb - entry file for table library
|
2
2
|
#
|
3
3
|
# Copyright (C) 2010-2013 Tanaka Akira <akr@fsij.org>
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without
|
6
6
|
# modification, are permitted provided that the following conditions
|
7
7
|
# are met:
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# 1. Redistributions of source code must retain the above copyright
|
10
10
|
# notice, this list of conditions and the following disclaimer.
|
11
11
|
# 2. Redistributions in binary form must reproduce the above
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# 3. The name of the author may not be used to endorse or promote
|
16
16
|
# products derived from this software without specific prior
|
17
17
|
# written permission.
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
20
20
|
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
21
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
data/lib/tb/basic.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# lib/tb/basic.rb - basic fetures for table library
|
2
2
|
#
|
3
3
|
# Copyright (C) 2010-2012 Tanaka Akira <akr@fsij.org>
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without
|
6
6
|
# modification, are permitted provided that the following conditions
|
7
7
|
# are met:
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# 1. Redistributions of source code must retain the above copyright
|
10
10
|
# notice, this list of conditions and the following disclaimer.
|
11
11
|
# 2. Redistributions in binary form must reproduce the above
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# 3. The name of the author may not be used to endorse or promote
|
16
16
|
# products derived from this software without specific prior
|
17
17
|
# written permission.
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
20
20
|
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
21
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -220,11 +220,11 @@ class Tb
|
|
220
220
|
#
|
221
221
|
# returns true if the field specified by the argument is exist.
|
222
222
|
#
|
223
|
-
# t = Tb.new %w[fruit color],
|
224
|
-
# %w[apple red],
|
225
|
-
# %w[banana yellow],
|
226
|
-
# %w[orange orange]
|
227
|
-
# pp t
|
223
|
+
# t = Tb.new %w[fruit color],
|
224
|
+
# %w[apple red],
|
225
|
+
# %w[banana yellow],
|
226
|
+
# %w[orange orange]
|
227
|
+
# pp t
|
228
228
|
# #=> #<Tb
|
229
229
|
# # {"_recordid"=>0, "fruit"=>"apple", "color"=>"red"}
|
230
230
|
# # {"_recordid"=>1, "fruit"=>"banana", "color"=>"yellow"}
|
@@ -323,7 +323,7 @@ class Tb
|
|
323
323
|
# # {"_recordid"=>1, "fruit"=>"banana", "color"=>"yellow"}
|
324
324
|
# # {"_recordid"=>2, "fruit"=>"orange", "color"=>"orange"}>
|
325
325
|
# p t.list_recordids #=> [0, 1, 2]
|
326
|
-
#
|
326
|
+
#
|
327
327
|
def list_recordids
|
328
328
|
@tbl["_recordid"].compact
|
329
329
|
end
|
@@ -333,10 +333,10 @@ class Tb
|
|
333
333
|
#
|
334
334
|
# returns the number of records.
|
335
335
|
#
|
336
|
-
# t = Tb.new %w[fruit],
|
337
|
-
# %w[apple],
|
338
|
-
# %w[banana],
|
339
|
-
# %w[orange]
|
336
|
+
# t = Tb.new %w[fruit],
|
337
|
+
# %w[apple],
|
338
|
+
# %w[banana],
|
339
|
+
# %w[orange]
|
340
340
|
# pp t
|
341
341
|
# #=> #<Tb
|
342
342
|
# # {"_recordid"=>0, "fruit"=>"apple"}
|
@@ -360,10 +360,10 @@ class Tb
|
|
360
360
|
# p t0.empty?
|
361
361
|
# #=> true
|
362
362
|
#
|
363
|
-
# t3 = Tb.new %w[fruit],
|
364
|
-
# %w[apple],
|
365
|
-
# %w[banana],
|
366
|
-
# %w[orange]
|
363
|
+
# t3 = Tb.new %w[fruit],
|
364
|
+
# %w[apple],
|
365
|
+
# %w[banana],
|
366
|
+
# %w[orange]
|
367
367
|
# pp t3
|
368
368
|
# #=> #<Tb
|
369
369
|
# # {"_recordid"=>0, "fruit"=>"apple"}
|
@@ -514,7 +514,7 @@ class Tb
|
|
514
514
|
# t = Tb.new %w[fruit color],
|
515
515
|
# %w[apple red],
|
516
516
|
# %w[banana yellow],
|
517
|
-
# %w[orange orange]
|
517
|
+
# %w[orange orange]
|
518
518
|
# pp t
|
519
519
|
# #=> #<Tb
|
520
520
|
# # {"_recordid"=>0, "fruit"=>"apple", "color"=>"red"}
|
@@ -531,7 +531,7 @@ class Tb
|
|
531
531
|
def delete_cell(recordid, field)
|
532
532
|
recordid = check_recordid(recordid)
|
533
533
|
field = check_field(field)
|
534
|
-
raise ArgumentError, "can not delete reserved field: #{field.inspect}" if field.start_with?("_")
|
534
|
+
raise ArgumentError, "can not delete reserved field: #{field.inspect}" if field.start_with?("_")
|
535
535
|
ary = @tbl[field]
|
536
536
|
index = @recordid2index[recordid]
|
537
537
|
old = ary[index]
|
@@ -703,7 +703,7 @@ class Tb
|
|
703
703
|
# # {"_recordid"=>0, "fruit"=>"apple", "color"=>"red"}
|
704
704
|
# # {"_recordid"=>1, "fruit"=>"banana", "color"=>"yellow"}
|
705
705
|
# # {"_recordid"=>2, "fruit"=>"orange", "color"=>"orange"}>
|
706
|
-
# p t.update_record(1, {"color"=>"green"})
|
706
|
+
# p t.update_record(1, {"color"=>"green"})
|
707
707
|
# #=> nil
|
708
708
|
# pp t
|
709
709
|
# #=> #<Tb
|
@@ -761,7 +761,7 @@ class Tb
|
|
761
761
|
# # {"_recordid"=>0, "fruit"=>"apple", "color"=>"red"}
|
762
762
|
# # {"_recordid"=>1, "fruit"=>"banana", "color"=>"yellow"}
|
763
763
|
# # {"_recordid"=>2, "fruit"=>"orange", "color"=>"orange"}>
|
764
|
-
# p t.get_record(1)
|
764
|
+
# p t.get_record(1)
|
765
765
|
# #=> #<Tb::Record: "_recordid"=>1, "fruit"=>"banana", "color"=>"yellow">
|
766
766
|
#
|
767
767
|
def get_record(recordid)
|
@@ -774,10 +774,10 @@ class Tb
|
|
774
774
|
#
|
775
775
|
# iterates over the non-reserved field names of the table.
|
776
776
|
#
|
777
|
-
# t = Tb.new %w[fruit color],
|
778
|
-
# %w[apple red],
|
779
|
-
# %w[banana yellow],
|
780
|
-
# %w[orange orange]
|
777
|
+
# t = Tb.new %w[fruit color],
|
778
|
+
# %w[apple red],
|
779
|
+
# %w[banana yellow],
|
780
|
+
# %w[orange orange]
|
781
781
|
# pp t
|
782
782
|
# #=> #<Tb
|
783
783
|
# # {"_recordid"=>0, "fruit"=>"apple", "color"=>"red"}
|
@@ -800,10 +800,10 @@ class Tb
|
|
800
800
|
#
|
801
801
|
# iterates over the reserved and non-reserved field names of the table.
|
802
802
|
#
|
803
|
-
# t = Tb.new %w[fruit color],
|
804
|
-
# %w[apple red],
|
805
|
-
# %w[banana yellow],
|
806
|
-
# %w[orange orange]
|
803
|
+
# t = Tb.new %w[fruit color],
|
804
|
+
# %w[apple red],
|
805
|
+
# %w[banana yellow],
|
806
|
+
# %w[orange orange]
|
807
807
|
# pp t
|
808
808
|
# #=> #<Tb
|
809
809
|
# # {"_recordid"=>0, "fruit"=>"apple", "color"=>"red"}
|
@@ -862,7 +862,7 @@ class Tb
|
|
862
862
|
# # {"_recordid"=>0, "fruit"=>"apple", "color"=>"red"}
|
863
863
|
# # {"_recordid"=>1, "fruit"=>"banana", "color"=>"yellow"}
|
864
864
|
# # {"_recordid"=>2, "fruit"=>"orange", "color"=>"orange"}>
|
865
|
-
# pp t.to_a
|
865
|
+
# pp t.to_a
|
866
866
|
# #=> [#<Tb::Record: "fruit"=>"apple", "color"=>"red">,
|
867
867
|
# # #<Tb::Record: "fruit"=>"banana", "color"=>"yellow">,
|
868
868
|
# # #<Tb::Record: "fruit"=>"orange", "color"=>"orange">]
|
@@ -892,7 +892,7 @@ class Tb
|
|
892
892
|
# # {"_recordid"=>0, "fruit"=>"apple", "color"=>"red"}
|
893
893
|
# # {"_recordid"=>1, "fruit"=>"banana", "color"=>"yellow"}
|
894
894
|
# # {"_recordid"=>2, "fruit"=>"orange", "color"=>"orange"}>
|
895
|
-
# t.each_record {|record| p record }
|
895
|
+
# t.each_record {|record| p record }
|
896
896
|
# #=> #<Tb::Record: "fruit"=>"apple", "color"=>"red">
|
897
897
|
# # #<Tb::Record: "fruit"=>"banana", "color"=>"yellow">
|
898
898
|
# # #<Tb::Record: "fruit"=>"orange", "color"=>"orange">
|
@@ -918,7 +918,7 @@ class Tb
|
|
918
918
|
# table.header_and_each(header_proc) {|record| ... }
|
919
919
|
#
|
920
920
|
# +header_and_each+ calls _header_proc_ at first.
|
921
|
-
# The block is called for each record after that.
|
921
|
+
# The block is called for each record after that.
|
922
922
|
#
|
923
923
|
def header_and_each(header_proc, &block)
|
924
924
|
header_proc.call(list_fields) if header_proc
|
@@ -952,7 +952,7 @@ class Tb
|
|
952
952
|
y.yield record.to_h
|
953
953
|
}
|
954
954
|
}
|
955
|
-
er = t1.natjoin2(t2, missing, retain_left, retain_right)
|
955
|
+
er = t1.natjoin2(t2, missing, retain_left, retain_right)
|
956
956
|
result = nil
|
957
957
|
er.with_header {|header|
|
958
958
|
result = Tb.new header
|
@@ -984,7 +984,7 @@ class Tb
|
|
984
984
|
def delete_field(*fields)
|
985
985
|
fields.each {|f|
|
986
986
|
f = check_field(f)
|
987
|
-
raise ArgumentError, "can not delete reserved field: #{f.inspect}" if f.start_with?("_")
|
987
|
+
raise ArgumentError, "can not delete reserved field: #{f.inspect}" if f.start_with?("_")
|
988
988
|
@tbl.delete(f)
|
989
989
|
@field_list.delete(f)
|
990
990
|
}
|
data/lib/tb/catreader.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# lib/tb/catreader.rb - Tb::CatReader class
|
2
2
|
#
|
3
3
|
# Copyright (C) 2011-2012 Tanaka Akira <akr@fsij.org>
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Redistribution and use in source and binary forms, with or without
|
6
6
|
# modification, are permitted provided that the following conditions
|
7
7
|
# are met:
|
8
|
-
#
|
8
|
+
#
|
9
9
|
# 1. Redistributions of source code must retain the above copyright
|
10
10
|
# notice, this list of conditions and the following disclaimer.
|
11
11
|
# 2. Redistributions in binary form must reproduce the above
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# 3. The name of the author may not be used to endorse or promote
|
16
16
|
# products derived from this software without specific prior
|
17
17
|
# written permission.
|
18
|
-
#
|
18
|
+
#
|
19
19
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
20
20
|
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
21
21
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
data/lib/tb/cmd_cat.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (C) 2011-2012 Tanaka Akira <akr@fsij.org>
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Redistribution and use in source and binary forms, with or without
|
4
4
|
# modification, are permitted provided that the following conditions
|
5
5
|
# are met:
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# 1. Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# 2. Redistributions in binary form must reproduce the above
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# 3. The name of the author may not be used to endorse or promote
|
14
14
|
# products derived from this software without specific prior
|
15
15
|
# written permission.
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
18
18
|
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
19
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -42,11 +42,11 @@ end
|
|
42
42
|
Tb::Cmd.def_vhelp('cat', <<'End')
|
43
43
|
Example:
|
44
44
|
|
45
|
-
% cat tst1.csv
|
45
|
+
% cat tst1.csv
|
46
46
|
a,b,c
|
47
47
|
0,1,2
|
48
48
|
4,5,6
|
49
|
-
% cat tst2.csv
|
49
|
+
% cat tst2.csv
|
50
50
|
a,b,d
|
51
51
|
U,V,W
|
52
52
|
X,Y,Z
|
data/lib/tb/cmd_consecutive.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (C) 2011-2012 Tanaka Akira <akr@fsij.org>
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Redistribution and use in source and binary forms, with or without
|
4
4
|
# modification, are permitted provided that the following conditions
|
5
5
|
# are met:
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# 1. Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# 2. Redistributions in binary form must reproduce the above
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# 3. The name of the author may not be used to endorse or promote
|
14
14
|
# products derived from this software without specific prior
|
15
15
|
# written permission.
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
18
18
|
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
19
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -42,7 +42,7 @@ end
|
|
42
42
|
Tb::Cmd.def_vhelp('consecutive', <<'End')
|
43
43
|
Example:
|
44
44
|
|
45
|
-
% cat tst.csv
|
45
|
+
% cat tst.csv
|
46
46
|
a,b,c
|
47
47
|
0,1,2
|
48
48
|
4,5,6
|
data/lib/tb/cmd_crop.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (C) 2011-2012 Tanaka Akira <akr@fsij.org>
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Redistribution and use in source and binary forms, with or without
|
4
4
|
# modification, are permitted provided that the following conditions
|
5
5
|
# are met:
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# 1. Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# 2. Redistributions in binary form must reproduce the above
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# 3. The name of the author may not be used to endorse or promote
|
14
14
|
# products derived from this software without specific prior
|
15
15
|
# written permission.
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
18
18
|
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
19
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
@@ -107,7 +107,7 @@ def (Tb::Cmd).main_crop(argv)
|
|
107
107
|
lmargin = 0
|
108
108
|
while lmargin < ary.length
|
109
109
|
if !ary[lmargin].nil? && ary[lmargin] != ''
|
110
|
-
break
|
110
|
+
break
|
111
111
|
end
|
112
112
|
lmargin += 1
|
113
113
|
end
|
data/lib/tb/cmd_cross.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (C) 2011-2012 Tanaka Akira <akr@fsij.org>
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Redistribution and use in source and binary forms, with or without
|
4
4
|
# modification, are permitted provided that the following conditions
|
5
5
|
# are met:
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# 1. Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# 2. Redistributions in binary form must reproduce the above
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# 3. The name of the author may not be used to endorse or promote
|
14
14
|
# products derived from this software without specific prior
|
15
15
|
# written permission.
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
18
18
|
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
19
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
data/lib/tb/cmd_cut.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# Copyright (C) 2011-2012 Tanaka Akira <akr@fsij.org>
|
2
|
-
#
|
2
|
+
#
|
3
3
|
# Redistribution and use in source and binary forms, with or without
|
4
4
|
# modification, are permitted provided that the following conditions
|
5
5
|
# are met:
|
6
|
-
#
|
6
|
+
#
|
7
7
|
# 1. Redistributions of source code must retain the above copyright
|
8
8
|
# notice, this list of conditions and the following disclaimer.
|
9
9
|
# 2. Redistributions in binary form must reproduce the above
|
@@ -13,7 +13,7 @@
|
|
13
13
|
# 3. The name of the author may not be used to endorse or promote
|
14
14
|
# products derived from this software without specific prior
|
15
15
|
# written permission.
|
16
|
-
#
|
16
|
+
#
|
17
17
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
|
18
18
|
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
19
19
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|