ruby 去掉文件里重复的行
- 作者: sadasfsdf
- 来源: 51数据库
- 2021-08-18
old = file.open(argv[0]).collect
new = file.open(argv[1],"a+")
for i in 0..old.length-1
new.write(old.uniq[i])
end
##或简单两行也可以如qc.rb
old = file.open(argv[0]).collect
puts old.uniq
然后qc.rb dic.dic >new.dic
new = file.open(argv[1],"a+")
for i in 0..old.length-1
new.write(old.uniq[i])
end
##或简单两行也可以如qc.rb
old = file.open(argv[0]).collect
puts old.uniq
然后qc.rb dic.dic >new.dic
推荐阅读
