Zip codes
Extra fun with US zip codes
If you are 100% done with everything, you can have fun with the following exercise involving US zip codes. This is mostly for people with previous Unix experience.
You will find the following file:
/home/projects/22126_NGS/exercises/unix/ZIP_CODES.csv.gz
No need to copy it or unzip it. You can view it with zcat or zless.
csv stands for comma-separated values i.e. column1,column2,...
Some very useful commands:
For csv files, to get the first column, I recommend either:
zcat /home/projects/22126_NGS/exercises/unix/ZIP_CODES.csv.gz | cut -d , -f 1
zcat /home/projects/22126_NGS/exercises/unix/ZIP_CODES.csv.gz | awk 'BEGIN{FS=","}{put code here}'
Q1: How many zip codes are in New York State ( STATE = NY)
Q2: Among the zip codes in New York State from Q1, what are the top 3 cities with the most ZIP codes assigned to them?
Q3: Among the zip codes in New York State from Q1, how many cities have a single ZIP code assigned to them?
Q4: Among the zip codes in New York State from Q1, count how many cities have 1 ZIP code assigned to them, how many have 2 ZIP codes, how many have 3 ZIP codes, .... etc
Q5: How many zip codes are below the famous Mason-Dixon Line (Latitude < 39.4)
Q6: For each different US state, list the city with the most zip codes assigned to it.
Q7: How many cities in the file begin with the letter 'M' ?
Please find the answers here
Congratulations you finished the exercise!