ruby でCSVファイルの3列目でsort

rubyCSVファイルの3列目でsort

f=open("test.txt","r")
f=f.map{|i| i.split(",")}.sort_by{|elem| elem[3];}