Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #C:\Documents and Settings\Michael\Desktop>ruby test.rb
- #test.rb:5: undefined method `+' for nil:NilClass (NoMethodError)
- # from test.rb:3:in `foreach'
- # from test.rb:3
- array = Array.new
- File.foreach("All_fips55_delim.txt") do |line|
- newline = line.sub(/[0-9]*\t[0-9]*\t[0-9]*\t[a-zA-Z0-9 ]*\t[A-Z0-9]{2}\t([a-zA-Z ]*)\t\t\t([A-Z]{2})/, '')
- row = $1 + '|' + $2
- array << row
- end
- puts array.count
- #line = "1000759 37 39540 Populated Place U6 Lowgap NC 01 171 Surry 36.5256863 -80.8672961 2744"
- #line2 = "648686 27 47221 Populated Place C5 North Saint Paul MN 01 123 Ramsey 45.0124657 -92.9918828 5320"
- #newline = line2.sub(/[0-9]*\t[0-9]*\t[0-9]*\t[a-zA-Z0-9 ]*\t[A-Z0-9]{2}\t([a-zA-Z ]*)\t\t\t([A-Z]{2})/, '')
- #puts "\n\n\n"
- #puts "New line: " + newline + "\n\n\n"
- #puts "$1: " + $1 + "\n\n\n"
- #puts "$2: " + $2 + "\n\n\n"
- #puts $1 + "|" + $2
Add Comment
Please, Sign In to add comment