回答編集履歴
1
1列目の削除処理を追加
test
CHANGED
@@ -17,6 +17,8 @@
|
|
17
17
|
table = CSV.table(infile)
|
18
18
|
|
19
19
|
table[:col3] = table[:col1]
|
20
|
+
|
21
|
+
table.by_col!.delete(:col1)
|
20
22
|
|
21
23
|
File.write(outfile, table)
|
22
24
|
|
@@ -52,23 +54,23 @@
|
|
52
54
|
|
53
55
|
$ cat out.csv
|
54
56
|
|
57
|
+
col2,col3
|
58
|
+
|
59
|
+
1,a
|
60
|
+
|
61
|
+
2,b
|
62
|
+
|
63
|
+
3,c
|
64
|
+
|
65
|
+
4,d
|
66
|
+
|
67
|
+
5,e
|
68
|
+
|
69
|
+
6,f
|
70
|
+
|
71
|
+
7,g
|
55
72
|
|
56
73
|
|
57
|
-
col1,col2,col3
|
58
|
-
|
59
|
-
a,1,a
|
60
|
-
|
61
|
-
b,2,b
|
62
|
-
|
63
|
-
c,3,c
|
64
|
-
|
65
|
-
d,4,d
|
66
|
-
|
67
|
-
e,5,e
|
68
|
-
|
69
|
-
f,6,f
|
70
|
-
|
71
|
-
g,7,g
|
72
74
|
|
73
75
|
```
|
74
76
|
|