Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the dead URL #126

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions www/src/2e/chapter-3-obtaining-data.html
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ <h2>
<p><span class="callout">➊</span> The <code>-H</code> option specifies that the CSV file has no header.</p>
<p>Let’s demonstrate <code>in2csv</code> using a spreadsheet that contains the 2000 most popular songs according to an annual Dutch marathon radio program <a href="https://www.top2000nl.com">Top 2000</a>.
To extract its data, you invoke <code>in2csv</code> as follows:</p>
<pre><span style="font-weight: bold">$</span> <span style="color: #5f8700">curl</span> <span style="color: #af8700">"https://www.nporadio2.nl/data/download/TOP-2000-2020.xlsx"</span> <span style="color: #af8700">&gt;</span> <span style="text-decoration: underline">top2000.xls
<pre><span style="font-weight: bold">$</span> <span style="color: #5f8700">curl</span> <span style="color: #af8700">"https://cms-assets.nporadio.nl/npoRadio2/TOP-2000-2021.xlsx?v=1639653660"</span> <span style="color: #af8700">&gt;</span> <span style="text-decoration: underline">top2000.xls
x</span>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
Expand All @@ -464,10 +464,10 @@ <h2>
BadZipFile: File is not a zip file</pre>
<p>Who is Danny Vera? The most popular song is supposed to be <em>Bohemian Rhapsody</em>, of course.
Well, at least Queen appears plenty of times in the Top 2000 so I can’t really complain:</p>
<pre><span style="font-weight: bold">$</span> <span style="color: #5f8700">csvgrep</span> <span style="text-decoration: underline">top2000.csv</span> --columns ARTIEST --regex <span style="color: #af8700">'^Queen$'</span> | <span style="color: #5f8700">csvlook</span> -I <span class="callout">➊</span>
<pre><span style="font-weight: bold">$</span> <span style="color: #5f8700">csvgrep</span> <span style="text-decoration: underline">top2000.csv</span> --columns artiest --regex <span style="color: #af8700">'^Queen$'</span> | <span style="color: #5f8700">csvlook</span> -I <span class="callout">➊</span>
StopIteration:
StopIteration:</pre>
<p><span class="callout">➊</span> The value after the <code>--regex</code> options is a regular expression (or <em>regex</em>). It’s a special syntax for defining patterns. Here, I only want to match artists that exactly match “Queen,” so I use the caret (<code>^</code>) and dollar sign (<code>$</code>) to match the start and end of the values in the column <em><code>ARTIEST</code></em>.</p>
<p><span class="callout">➊</span> The value after the <code>--regex</code> options is a regular expression (or <em>regex</em>). It’s a special syntax for defining patterns. Here, I only want to match artists that exactly match “Queen,” so I use the caret (<code>^</code>) and dollar sign (<code>$</code>) to match the start and end of the values in the column <em><code>artiest</code></em>.</p>
<p>By the way, the tools <code>in2csv</code>, <code>csvgrep</code>, and <code>csvlook</code> are part of CSVkit, which is a collection of command-line tools to work with CSV data.</p>
<p>The format of the file is automatically determined by the extension, <em>.xlsx</em> in this case.
If you were to pipe the data into <code>in2csv</code>, you would have to specify the format explicitly.</p>
Expand Down