I have a very big file with german postalcodes/zipcodes. For each code I want to find the correct federal state. What I did is the following: 1. I printed the zipcodes in a new file. 2. I sorted them and kicked out double cases. Now I had a new file with 2267 different zipcodes. 3. I created a awk command which should find one name for each code looking like this:
{if ($1 >= 01001 && $1 <=01936)
print "Sachsen" >"PLZ6.txt"}
{if ($1 >= 01941 && $1 <= 01998)
print "Brandenburg" >"PLZ6.txt"}
{if ($1 >= 02601 && $1 <= 02999)
print "Sachsen" >"PLZ6.txt"}
{if ($1 >= 03001 && $1 <= 03253)
print "Brandenburg" >"PLZ6.txt"} #this goes on for another 150 different lines...
So I thought I get one name for exactly one zipcode (if it falls in the range of the condition). That means I should have exactly 2267 cases in my new file. However, my new file as 23k cases.
I wonder, if the zip code falls into multiple ranges...Do you have any idea, why the zipcode could fit into several conditions? I want to have every zipcode matching exactly one condition.
Aucun commentaire:
Enregistrer un commentaire