テキストファイルの内容をソートするプログラム その1
その1なので例外処理も何もしていませんが、
CSV形式の並び替えには十分使えます。
追記:並び替えは、辞書式で行われます。
file_path = ARGV[0]read_file = open(file_path)
write_file = open("result_" + file_path, "w")temp_lines = []
read_file.each do |line|
temp_lines << line
endtemp_lines.sort!
temp_lines.each do |line|
write_file.puts line
endread_file.close
write_file.close