<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://teaching.healthtech.dtu.dk/22126/index.php?action=history&amp;feed=atom&amp;title=Zip_codes</id>
	<title>Zip codes - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://teaching.healthtech.dtu.dk/22126/index.php?action=history&amp;feed=atom&amp;title=Zip_codes"/>
	<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22126/index.php?title=Zip_codes&amp;action=history"/>
	<updated>2026-04-07T17:21:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://teaching.healthtech.dtu.dk/22126/index.php?title=Zip_codes&amp;diff=17&amp;oldid=prev</id>
		<title>WikiSysop: Created page with &quot; &lt;H2&gt;Extra fun with US zip codes&lt;/H2&gt;  &lt;p&gt;If you are 100% done with everything, you can have fun with the following exercise involving [https://en.wikipedia.org/wiki/ZIP_Code US zip codes]. This is mostly for people with previous Unix experience. &lt;/p&gt;  You will find the following file:  &lt;pre&gt; /home/projects/22126_NGS/exercises/unix/ZIP_CODES.csv.gz &lt;/pre&gt;   No need to copy it or unzip it. You can view it with &#039;&#039;&#039;zcat&#039;&#039;&#039; or &#039;&#039;&#039;zless&#039;&#039;&#039;.  csv stands for comma-separated val...&quot;</title>
		<link rel="alternate" type="text/html" href="https://teaching.healthtech.dtu.dk/22126/index.php?title=Zip_codes&amp;diff=17&amp;oldid=prev"/>
		<updated>2024-03-19T15:23:55Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; &amp;lt;H2&amp;gt;Extra fun with US zip codes&amp;lt;/H2&amp;gt;  &amp;lt;p&amp;gt;If you are 100% done with everything, you can have fun with the following exercise involving [https://en.wikipedia.org/wiki/ZIP_Code US zip codes]. This is mostly for people with previous Unix experience. &amp;lt;/p&amp;gt;  You will find the following file:  &amp;lt;pre&amp;gt; /home/projects/22126_NGS/exercises/unix/ZIP_CODES.csv.gz &amp;lt;/pre&amp;gt;   No need to copy it or unzip it. You can view it with &amp;#039;&amp;#039;&amp;#039;zcat&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;zless&amp;#039;&amp;#039;&amp;#039;.  csv stands for comma-separated val...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
&amp;lt;H2&amp;gt;Extra fun with US zip codes&amp;lt;/H2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;If you are 100% done with everything, you can have fun with the following exercise involving [https://en.wikipedia.org/wiki/ZIP_Code US zip codes]. This is mostly for people with previous Unix experience. &amp;lt;/p&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You will find the following file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/home/projects/22126_NGS/exercises/unix/ZIP_CODES.csv.gz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
No need to copy it or unzip it. You can view it with &amp;#039;&amp;#039;&amp;#039;zcat&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;zless&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
&lt;br /&gt;
csv stands for comma-separated values i.e. column1,column2,...&lt;br /&gt;
&lt;br /&gt;
Some very useful commands:&lt;br /&gt;
&amp;lt;OL&amp;gt;&lt;br /&gt;
&amp;lt;LI&amp;gt; [https://www.geeksforgeeks.org/cat-command-in-linux-with-examples/ cat] or in our case &amp;#039;&amp;#039;&amp;#039;zcat&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&amp;lt;LI&amp;gt; [https://www.geeksforgeeks.org/head-command-linux-examples/ head]&lt;br /&gt;
&amp;lt;LI&amp;gt; [https://www.geeksforgeeks.org/tail-command-linux-examples/ tail]&lt;br /&gt;
&amp;lt;LI&amp;gt; [https://www.geeksforgeeks.org/awk-command-unixlinux-examples/ awk]&lt;br /&gt;
&amp;lt;LI&amp;gt; [https://www.geeksforgeeks.org/sed-command-in-linux-unix-with-examples/ sed]&lt;br /&gt;
&amp;lt;LI&amp;gt; [https://www.geeksforgeeks.org/sort-command-linuxunix-examples/ sort]&lt;br /&gt;
&amp;lt;LI&amp;gt; [https://www.geeksforgeeks.org/uniq-command-in-linux-with-examples/ uniq]&lt;br /&gt;
&amp;lt;LI&amp;gt; [https://www.geeksforgeeks.org/wc-command-linux-examples/ wc]&lt;br /&gt;
&amp;lt;LI&amp;gt; [https://www.geeksforgeeks.org/grep-command-in-unixlinux/ grep]&lt;br /&gt;
&amp;lt;/OL&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For csv files, to get the first column, I recommend either:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zcat /home/projects/22126_NGS/exercises/unix/ZIP_CODES.csv.gz | cut -d , -f 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
zcat /home/projects/22126_NGS/exercises/unix/ZIP_CODES.csv.gz |  awk &amp;#039;BEGIN{FS=&amp;quot;,&amp;quot;}{put code here}&amp;#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q1:&amp;#039;&amp;#039;&amp;#039; How many zip codes are in New York State ( STATE = NY)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q2:&amp;#039;&amp;#039;&amp;#039; Among the zip codes in New York State from Q1, what are the top 3 cities with the most ZIP codes assigned to them?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q3:&amp;#039;&amp;#039;&amp;#039;  Among the zip codes in New York State from Q1, how many cities have a single ZIP code assigned to them?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q4:&amp;#039;&amp;#039;&amp;#039; 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&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q5:&amp;#039;&amp;#039;&amp;#039; How many zip codes are below the famous [http://en.wikipedia.org/wiki/Mason%E2%80%93Dixon_Line Mason-Dixon Line] (Latitude &amp;lt; 39.4)   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q6:&amp;#039;&amp;#039;&amp;#039; For each different US state, list the city with the most zip codes assigned to it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Q7:&amp;#039;&amp;#039;&amp;#039; How many cities in the file begin with the letter &amp;#039;M&amp;#039; ?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Please find the answers [[Zip_codes_answers|here]] &lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Congratulations you finished the exercise!&amp;#039;&amp;#039;&amp;#039;&lt;/div&gt;</summary>
		<author><name>WikiSysop</name></author>
	</entry>
</feed>