Hi
Inexperienced ruby user question:
I have 2 large csv files:
1) Zipdata = basically a frequency table of zipcodes:
02115, 10
64108, 9
99234, 8 etc
2) Ziplookup (ziplu) = several column table of data assoc with
zipcodes:
02115, +43.59906, -75,99343, Hoboken, NJ, Johnson Cty
55021, +55.5454, - 64,8585, Kansas City, MO, Jackson Cty
I am trying to take each entry in the zipdata and compare the zipcode
to the lookup table
When a match is found, combine the data into a new line /
multidimensional hash table eg -
02115, 10, +43.59906, -75,99343, Hoboken, NJ, Johnson Cty
Here is what I have:
outf = File.read "ZIP_CODES.txt"
ziplu=[]
zipdata = []
result = []
outf.each {|e| ziplu.push e.chomp}
# open the csv file of zip code occurences and their frequency (zips),
and add each zipcode to an array (zipdata)
doc = File.read "zips.txt"
doc.each {|f| zipdata.push f}
#compare each line from zipsdata to the lookup file and put into new
array
result.push(zipdata.each {|a| ziplu.find_all{|x| /a/ =~ x})
I can't get the comparison to work, and don't know what format to put
the result into (hash, array of arrays, file) - from which I can
easily output the results (ie., lat long, city, state) by zipcode...
Any guidance appreciated..
CLS