doc neaten: faq

This commit is contained in:
John Kerl 2017-02-20 21:18:03 -05:00
parent 1365b1eede
commit dce2a185b7
4 changed files with 78 additions and 101 deletions

View file

@ -10,7 +10,8 @@ POKI_PUT_TOC_HERE
<p/>Try <tt>od -xcv</tt> and/or <tt>cat -e</tt> on your file to check for non-printable characters.
<p/>If you&rsquo;re using Miller version less than 5.0.0, when the
<p/>If you&rsquo;re using Miller version less than 5.0.0 (try
<tt>mlr --version</tt> on your system to find out), when the
line-ending-autodetect feature was introduced, please see
<a href="http://johnkerl.org/miller-releases/miller-4.5.0/doc/index.html">here</a>.
@ -35,21 +36,6 @@ case: <tt>mlr --fs tab {remaining arguments ...}</tt>.
POKI_INCLUDE_ESCAPED(data/delimiter-examples.txt)HERE
</div>
<h1>Error-output in certain string cases</h1>
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="toggle_by_name('section_toggle_error_output');" href="javascript:;">Toggle section visibility</button>
<div id="section_toggle_error_output" style="display: block">
<p/> <tt>mlr put '$y = string($x)' then put '$z = $y . $y'</tt> gives
<tt>(error)</tt> on numeric data such as <tt>x=123</tt>, while <tt>mlr put
'$z=string($x).string($x)'</tt> and <tt>mlr put '$y = string($x); $z = $y .
$y'</tt> do not. This is because in the first case <tt>y</tt> is computed and
stored as a string, then re-parsed as an integer, for which
string-concatenation is an invalid operator. In the second case, casts are done
independently; in the third case, both assignments are within the same
<tt>put</tt> statement, where type information is maintained for the duration
of all assignments in the <tt>put</tt>.
</div>
<h1>How do I examine then-chaining?</h1>
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="toggle_by_name('section_toggle_examine_then_chaining');" href="javascript:;">Toggle section visibility</button>
@ -141,6 +127,10 @@ numbers, you can use out-of-stream variables as follows:
POKI_INCLUDE_AND_RUN_ESCAPED(data/dynamic-nr.sh)HERE
<p/>Or, simply use <tt>mlr cat -n</tt>:
POKI_RUN_COMMAND{{mlr filter '$x > 0.5' then cat -n data/small}}HERE
</div>
<h1>Why am I not seeing all possible joins occur?</h1>
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="toggle_by_name('section_toggle_not_all_possible_joins');" href="javascript:;">Toggle section visibility</button>

View file

@ -1091,33 +1091,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put '
' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds
i o fcount seconds_delta
1 1 1 0
2 2 3 0.000031948
2 2 3 0.000035048
3 3 5 0.000013113
4 5 9 0.000015020
5 8 15 0.000020027
6 13 25 0.000028849
7 21 41 0.000043154
8 34 67 0.000066996
9 55 109 0.000104904
10 89 177 0.000168085
11 144 287 0.000270844
12 233 465 0.000430107
13 377 753 0.000833035
14 610 1219 0.001605988
15 987 1973 0.002301931
16 1597 3193 0.003437996
17 2584 5167 0.004857063
18 4181 8361 0.007688999
19 6765 13529 0.012132883
20 10946 21891 0.019768000
21 17711 35421 0.031412125
22 28657 57313 0.051345825
23 46368 92735 0.084591150
24 75025 150049 0.129524946
25 121393 242785 0.220007896
26 196418 392835 0.369331121
27 317811 635621 0.595546961
28 514229 1028457 0.885719061
4 5 9 0.000024796
5 8 15 0.000020981
6 13 25 0.000041008
7 21 41 0.000055075
8 34 67 0.000067949
9 55 109 0.000109196
10 89 177 0.000182867
11 144 287 0.000307083
12 233 465 0.000439882
13 377 753 0.000730991
14 610 1219 0.001173973
15 987 1973 0.001893044
16 1597 3193 0.003154993
17 2584 5167 0.004925966
18 4181 8361 0.007686138
19 6765 13529 0.012122869
20 10946 21891 0.019392014
21 17711 35421 0.031095982
22 28657 57313 0.050091982
23 46368 92735 0.080941200
24 75025 150049 0.130611897
25 121393 242785 0.216569901
26 196418 392835 0.340492010
27 317811 635621 0.582877159
28 514229 1028457 0.934934855
</pre>
</div>
<p/>
@ -1149,33 +1149,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put '
' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds
i o fcount seconds_delta
1 1 1 0
2 2 3 0.000035048
3 3 3 0.000011921
4 5 3 0.000010967
5 8 3 0.000010967
6 13 3 0.000010014
7 21 3 0.000010014
2 2 3 0.000036001
3 3 3 0.000014067
4 5 3 0.000011921
5 8 3 0.000011921
6 13 3 0.000011206
7 21 3 0.000010967
8 34 3 0.000010967
9 55 3 0.000009060
9 55 3 0.000010967
10 89 3 0.000011921
11 144 3 0.000010967
12 233 3 0.000014067
13 377 3 0.000010014
14 610 3 0.000010014
15 987 3 0.000010014
16 1597 3 0.000010014
11 144 3 0.000012159
12 233 3 0.000015020
13 377 3 0.000010967
14 610 3 0.000011921
15 987 3 0.000010967
16 1597 3 0.000010967
17 2584 3 0.000010014
18 4181 3 0.000010014
19 6765 3 0.000009060
20 10946 3 0.000010014
21 17711 3 0.000009775
22 28657 3 0.000010014
23 46368 3 0.000012159
24 75025 3 0.000010014
25 121393 3 0.000010014
26 196418 3 0.000008821
27 317811 3 0.000010014
28 514229 3 0.000010014
18 4181 3 0.000010967
19 6765 3 0.000010967
20 10946 3 0.000011206
21 17711 3 0.000010014
22 28657 3 0.000010967
23 46368 3 0.000012875
24 75025 3 0.000010967
25 121393 3 0.000011206
26 196418 3 0.000009775
27 317811 3 0.000011206
28 514229 3 0.000010967
</pre>
</div>
<p/>

View file

@ -9,18 +9,13 @@ KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR
masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
# Try (unsuccessfully) to extract a few fields:
# Extract a few fields:
$ mlr --csv cut -f KEY,PL,RO data/colours.csv
(no output)
# Use LF record separator (--rs lf) since the file doesn't have CR/LF line
# endings -- but still unsuccessfully:
$ mlr --csv --rs lf cut -f KEY,PL,RO data/colours.csv
(only blank lines appear)
# Use XTAB output format to get a sharper picture of where records/fields
# are being split:
$ mlr --icsv --irs lf --oxtab cat data/colours.csv
$ mlr --icsv --oxtab cat data/colours.csv
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
@ -30,7 +25,7 @@ KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_2;Schwarz;Black;Negro;Mu
# subsequent line is being treated as a single field value. This is because
# the default field separator is a comma but we have semicolons here.
# Use XTAB again with different field separator (--fs semicolon):
$ mlr --icsv --irs lf --ifs semicolon --oxtab cat data/colours.csv
mlr --icsv --ifs semicolon --oxtab cat data/colours.csv
KEY masterdata_colourcode_1
DE Weiß
EN White
@ -56,7 +51,7 @@ RO Negru
TR Siyah
# Using the new field-separator, retry the cut:
$ mlr --csv --rs lf --fs semicolon cut -f KEY,PL,RO data/colours.csv
mlr --csv --fs semicolon cut -f KEY,PL,RO data/colours.csv
KEY;PL;RO
masterdata_colourcode_1;Biały;Alb
masterdata_colourcode_2;Czarny;Negru

View file

@ -190,7 +190,6 @@ Miller commands were run with pretty-print-tabular output format.
&bull;&nbsp;<a href="#No_output_at_all">No output at all</a><br/>
&bull;&nbsp;<a href="#Fields_not_selected">Fields not selected</a><br/>
&bull;&nbsp;<a href="#Diagnosing_delimiter_specifications">Diagnosing delimiter specifications</a><br/>
&bull;&nbsp;<a href="#Error-output_in_certain_string_cases">Error-output in certain string cases</a><br/>
&bull;&nbsp;<a href="#How_do_I_examine_then-chaining?">How do I examine then-chaining?</a><br/>
&bull;&nbsp;<a href="#I_assigned_$9_and_it&rsquo;s_not_9th">I assigned $9 and it&rsquo;s not 9th</a><br/>
&bull;&nbsp;<a href="#Why_doesn&rsquo;t_mlr_cut_put_fields_in_the_order_I_want?">Why doesn&rsquo;t mlr cut put fields in the order I want?</a><br/>
@ -210,7 +209,8 @@ Miller commands were run with pretty-print-tabular output format.
<p/>Try <tt>od -xcv</tt> and/or <tt>cat -e</tt> on your file to check for non-printable characters.
<p/>If you&rsquo;re using Miller version less than 5.0.0, when the
<p/>If you&rsquo;re using Miller version less than 5.0.0 (try
<tt>mlr --version</tt> on your system to find out), when the
line-ending-autodetect feature was introduced, please see
<a href="http://johnkerl.org/miller-releases/miller-4.5.0/doc/index.html">here</a>.
@ -247,18 +247,13 @@ KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR
masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
# Try (unsuccessfully) to extract a few fields:
# Extract a few fields:
$ mlr --csv cut -f KEY,PL,RO data/colours.csv
(no output)
# Use LF record separator (--rs lf) since the file doesn't have CR/LF line
# endings -- but still unsuccessfully:
$ mlr --csv --rs lf cut -f KEY,PL,RO data/colours.csv
(only blank lines appear)
# Use XTAB output format to get a sharper picture of where records/fields
# are being split:
$ mlr --icsv --irs lf --oxtab cat data/colours.csv
$ mlr --icsv --oxtab cat data/colours.csv
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_1;Weiß;White;Blanco;Valkoinen;Blanc;Bianco;Wit;Biały;Alb;Beyaz
KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_2;Schwarz;Black;Negro;Musta;Noir;Nero;Zwart;Czarny;Negru;Siyah
@ -268,7 +263,7 @@ KEY;DE;EN;ES;FI;FR;IT;NL;PL;RO;TR masterdata_colourcode_2;Schwarz;Black;Negro;Mu
# subsequent line is being treated as a single field value. This is because
# the default field separator is a comma but we have semicolons here.
# Use XTAB again with different field separator (--fs semicolon):
$ mlr --icsv --irs lf --ifs semicolon --oxtab cat data/colours.csv
mlr --icsv --ifs semicolon --oxtab cat data/colours.csv
KEY masterdata_colourcode_1
DE Weiß
EN White
@ -294,7 +289,7 @@ RO Negru
TR Siyah
# Using the new field-separator, retry the cut:
$ mlr --csv --rs lf --fs semicolon cut -f KEY,PL,RO data/colours.csv
mlr --csv --fs semicolon cut -f KEY,PL,RO data/colours.csv
KEY;PL;RO
masterdata_colourcode_1;Biały;Alb
masterdata_colourcode_2;Czarny;Negru
@ -302,21 +297,6 @@ masterdata_colourcode_2;Czarny;Negru
</div>
<p/>
</div>
<a id="Error-output_in_certain_string_cases"/><h1>Error-output in certain string cases</h1>
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="toggle_by_name('section_toggle_error_output');" href="javascript:;">Toggle section visibility</button>
<div id="section_toggle_error_output" style="display: block">
<p/> <tt>mlr put '$y = string($x)' then put '$z = $y . $y'</tt> gives
<tt>(error)</tt> on numeric data such as <tt>x=123</tt>, while <tt>mlr put
'$z=string($x).string($x)'</tt> and <tt>mlr put '$y = string($x); $z = $y .
$y'</tt> do not. This is because in the first case <tt>y</tt> is computed and
stored as a string, then re-parsed as an integer, for which
string-concatenation is an invalid operator. In the second case, casts are done
independently; in the third case, both assignments are within the same
<tt>put</tt> statement, where type information is maintained for the duration
of all assignments in the <tt>put</tt>.
</div>
<a id="How_do_I_examine_then-chaining?"/><h1>How do I examine then-chaining?</h1>
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="toggle_by_name('section_toggle_examine_then_chaining');" href="javascript:;">Toggle section visibility</button>
@ -582,6 +562,18 @@ wye pan 5 0.5732889198020006 0.8636244699032729 5 2
</div>
<p/>
<p/>Or, simply use <tt>mlr cat -n</tt>:
<p/>
<div class="pokipanel">
<pre>
$ mlr filter '$x &gt; 0.5' then cat -n data/small
n=1,a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
n=2,a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
</pre>
</div>
<p/>
</div>
<a id="Why_am_I_not_seeing_all_possible_joins_occur?"/><h1>Why am I not seeing all possible joins occur?</h1>
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="toggle_by_name('section_toggle_not_all_possible_joins');" href="javascript:;">Toggle section visibility</button>