#!ruby -p gsub /(\d)(?=(\d{3})+(?!\d))/,'\1,'