Update faq.html

This commit is contained in:
jungle-boogie 2015-10-09 07:38:08 -07:00
parent 9c733036d7
commit f3cecaa5b8

View file

@ -153,16 +153,16 @@ grep 'various sorts' *.log | sed 's/.*} //' | mlr --fs space --repifs stats1 -a
<a id="How_do_I_examine_then-chaining?"/><h1>How do I examine then-chaining?</h1>
<p/>Then-chaining in Miller is intended to function the same as Unix pipes. You
<p/>Then-chaining found in Miller is intended to function the same as Unix pipes. You
can print your data one pipeline step at a time, to see what intermediate
output at one step becomes the input to the next step.
<p/>First look at the input data:
<p/>First, review the input data:
<p/>
<div class="pokipanel">
<pre>
$ cat data/then-example.txt
$ cat data/then-example.csv
Status,Payment_Type,Amount
paid,cash,10.00
pending,debit,20.00
@ -173,12 +173,12 @@ paid,debit,30.00
</div>
<p/>
Then run the first step of your command, omitting anything from the first <tt>then</tt> onward:
Next, run the first step of your command, omitting anything from the first <tt>then</tt> onward:
<p/>
<div class="pokipanel">
<pre>
$ mlr --icsv --rs lf --opprint count-distinct -f Status,Payment_Type data/then-example.txt
$ mlr --icsv --rs lf --opprint count-distinct -f Status,Payment_Type data/then-example.csv
Status Payment_Type count
paid cash 2
pending debit 1
@ -188,12 +188,12 @@ paid debit 1
</div>
<p/>
Then run it with the next <tt>then</tt> step included:
After that, run it with the next <tt>then</tt> step included:
<p/>
<div class="pokipanel">
<pre>
$ mlr --icsv --rs lf --opprint count-distinct -f Status,Payment_Type then sort -nr count data/then-example.txt
$ mlr --icsv --rs lf --opprint count-distinct -f Status,Payment_Type then sort -nr count data/then-example.csv
Status Payment_Type count
paid cash 2
pending debit 1
@ -203,14 +203,14 @@ paid debit 1
</div>
<p/>
Now if you go on to include another <tt>then</tt> step after this, the columns <tt>Status</tt>,
<tt>Payment_Type</tt>, and <tt>count</tt> will be its input.
Now if you include another <tt>then</tt> step after this, the columns <tt>Status</tt>,
<tt>Payment_Type</tt> and <tt>count</tt> will be its input.
<p/>Note, by the way, that you&rsquo;ll get the same results using pipes:
<p/>Note, by the way, that you will get the same results using pipes:
<p/>
<div class="pokipanel">
<pre>
$ mlr --csv --rs lf count-distinct -f Status,Payment_Type data/then-example.txt | mlr --icsv --rs lf --opprint sort -nr count
$ mlr --csv --rs lf count-distinct -f Status,Payment_Type data/then-example.csv | mlr --icsv --rs lf --opprint sort -nr count
Status Payment_Type count
paid cash 2
pending debit 1