mirror of
https://github.com/johnkerl/miller.git
synced 2026-07-18 00:45:47 +00:00
mlrrc doc
This commit is contained in:
parent
2bd823fcac
commit
07790cac3e
15 changed files with 939 additions and 584 deletions
95
doc/content-for-customization.html
Normal file
95
doc/content-for-customization.html
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
POKI_PUT_TOC_HERE
|
||||
|
||||
<p/>
|
||||
<button style="font-weight:bold;color:maroon;border:0" onclick="bodyToggler.expandAll();" href="javascript:;">Expand all sections</button>
|
||||
<button style="font-weight:bold;color:maroon;border:0" onclick="bodyToggler.collapseAll();" href="javascript:;">Collapse all sections</button>
|
||||
|
||||
<h1>How to use .mlrrc</h1>
|
||||
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="bodyToggler.toggle('body_section_toggle_how');" href="javascript:;">Toggle section visibility</button>
|
||||
<div id="body_section_toggle_how" style="display: block">
|
||||
|
||||
<p>Suppose you always use CSV files. Then instead of always having to type
|
||||
<tt>--csv</tt> as in </p>
|
||||
|
||||
POKI_CARDIFY(mlr --csv cut -x -f extra mydata.csv)HERE
|
||||
|
||||
POKI_CARDIFY(mlr --csv sort -n id mydata.csv)HERE
|
||||
|
||||
<p>and so on, you can instead put the following into your <tt>$HOME/.mlrrc</tt>:</p>
|
||||
|
||||
POKI_CARDIFY(--csv)HERE
|
||||
|
||||
<p>Then you can just type things like</p>
|
||||
|
||||
POKI_CARDIFY(mlr cut -x -f extra mydata.csv)HERE
|
||||
|
||||
POKI_CARDIFY(mlr sort -n id mydata.csv)HERE
|
||||
|
||||
<p>and the <tt>--csv</tt> part will automatically be understood. (If you do
|
||||
want to process, say, a JSON file then <tt>mlr --json ...</tt> at the command
|
||||
line will override the default from your <tt>.mlrrc</tt>.)</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<h1>What you can put in your .mlrrc</h1>
|
||||
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="bodyToggler.toggle('body_section_toggle_what');" href="javascript:;">Toggle section visibility</button>
|
||||
<div id="body_section_toggle_what" style="display: block">
|
||||
|
||||
<ul>
|
||||
|
||||
<li>You can include any command-line flags, except the "terminal" ones such
|
||||
as <tt>--help</tt>. </li>
|
||||
|
||||
<li>The formatting rule is you need to put one flag beginning with
|
||||
<tt>--</tt> per line: for example, <tt>--csv</tt> on one line and
|
||||
<tt>--nr-progress-mod 1000</tt> on a separate line. </li>
|
||||
|
||||
<li>Since every line starts with a <tt>--</tt> option, you can leave off the
|
||||
initial <tt>--</tt> if you want. For example, <tt>ojson</tt> is the same as
|
||||
<tt>--ojson</tt>, and <tt>nr-progress-mod 1000</tt> is the same as
|
||||
<tt>--nr-progress-mod 1000</tt>.
|
||||
|
||||
<li>Comments are from a <tt>#</tt> to the end of the line.</li>
|
||||
|
||||
<li>Empty lines are ignored -- including lines which are empty after comments are removed.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>Here is an example <tt>.mlrrc file</tt>:
|
||||
|
||||
POKI_INCLUDE_ESCAPED(sample_mlrrc)HERE
|
||||
|
||||
</div>
|
||||
|
||||
<h1>Where to put your .mlrrc</h1>
|
||||
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="bodyToggler.toggle('body_section_toggle_where');" href="javascript:;">Toggle section visibility</button>
|
||||
<div id="body_section_toggle_where" style="display: block">
|
||||
|
||||
<ul>
|
||||
|
||||
<li>If the environment variable <tt>MLRRC</tt> is set:</li>
|
||||
|
||||
<ul>
|
||||
<li>If its value is <tt>__none__</tt> then no <tt>.mlrrc</tt> files are processed.
|
||||
(This is nice for things like regression testing.)</li>
|
||||
<li>Otherwise, its value (as a filename) is loaded and processed. If there
|
||||
are syntax errors, they abort <tt>mlr</tt> with a usage message (as if
|
||||
you had mistyped something on the command line). If the file can't be loaded at
|
||||
all, though, it is silently skipped.</li>
|
||||
<li>Any <tt>.mlrrc</tt> in your home directory or current directory is ignored whenever
|
||||
<tt>MLRRC</tt> is set in the environment.
|
||||
</ul>
|
||||
|
||||
<li>Otherwise:
|
||||
|
||||
<ul>
|
||||
<li>If <tt>$HOME/.mlrrc</tt> exists, it’s processed as above.</li>
|
||||
<li>If <tt>./.mlrrc</tt> exists, it’s then also processed as above.</li>
|
||||
<li>The idea is you can have all your settings in your <tt>$HOME/.mlrrc</tt>,
|
||||
then override maybe one or two for your current directory if you like.</li>
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
|
@ -50,6 +50,7 @@ pageTracker._trackPageview();
|
|||
|
||||
<br/>
|
||||
<br/><a href="faq.html">FAQ</a>
|
||||
<br/><a href="customization.html">Customization</a>
|
||||
<br/><a href="data-sharing.html">Mixing with other languages</a>
|
||||
<br/><a href="cookbook.html"><b>Cookbook part 1</b></a>
|
||||
<br/><a href="cookbook2.html">Cookbook part 2</a>
|
||||
|
|
@ -419,11 +420,11 @@ $ mlr put '
|
|||
"x": $y,
|
||||
};
|
||||
' data/small
|
||||
{ "z": 0.346790, "KEYFIELD": "pan", "i": 1, "b": "pan", "y": 0.346790, "x": 0.726803 }
|
||||
{ "z": 0.758680, "KEYFIELD": "eks", "i": 3, "b": "pan", "y": 0.758680, "x": 0.522151 }
|
||||
{ "z": 0.204603, "KEYFIELD": "wye", "i": 6, "b": "wye", "y": 0.204603, "x": 0.338319 }
|
||||
{ "z": 0.381399, "KEYFIELD": "eks", "i": 10, "b": "wye", "y": 0.381399, "x": 0.134189 }
|
||||
{ "z": 0.573289, "KEYFIELD": "wye", "i": 15, "b": "pan", "y": 0.573289, "x": 0.863624 }
|
||||
z=0.346790,KEYFIELD=pan,i=1,b=pan,y=0.346790,x=0.726803
|
||||
z=0.758680,KEYFIELD=eks,i=3,b=pan,y=0.758680,x=0.522151
|
||||
z=0.204603,KEYFIELD=wye,i=6,b=wye,y=0.204603,x=0.338319
|
||||
z=0.381399,KEYFIELD=eks,i=10,b=wye,y=0.381399,x=0.134189
|
||||
z=0.573289,KEYFIELD=wye,i=15,b=pan,y=0.573289,x=0.863624
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -452,11 +453,11 @@ a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$nr = NR' data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533, "nr": 1 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "nr": 2 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "nr": 3 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463, "nr": 4 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "nr": 5 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,nr=1
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,nr=2
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,nr=3
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,nr=4
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,nr=5
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -468,8 +469,8 @@ $ mlr put '$nr = NR' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr filter '$a == "wye"' then put '$nr = NR' data/small
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "nr": 3 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "nr": 5 }
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,nr=3
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,nr=5
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -480,8 +481,8 @@ $ mlr filter '$a == "wye"' then put '$nr = NR' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr filter '$a == "wye"' then cat -n data/small
|
||||
{ "n": 1, "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "n": 2, "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
n=1,a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
n=2,a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -492,8 +493,8 @@ $ mlr filter '$a == "wye"' then cat -n data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr filter '$a == "wye"' then put 'begin {@n = 1} $n = @n; @n += 1' data/small
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "n": 1 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "n": 2 }
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,n=1
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,n=2
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -876,16 +877,16 @@ $ mlr --from data/miss-date.csv --icsv \
|
|||
then put '$datestamp = strptime($date, "%Y-%m-%d")' \
|
||||
then step -a delta -f datestamp \
|
||||
| head
|
||||
{ "n": 1, "date": "2012-03-05", "qoh": 10055, "datestamp": 1330905600.000000, "datestamp_delta": 0 }
|
||||
{ "n": 2, "date": "2012-03-06", "qoh": 10486, "datestamp": 1330992000.000000, "datestamp_delta": 86400.000000 }
|
||||
{ "n": 3, "date": "2012-03-07", "qoh": 10430, "datestamp": 1331078400.000000, "datestamp_delta": 86400.000000 }
|
||||
{ "n": 4, "date": "2012-03-08", "qoh": 10674, "datestamp": 1331164800.000000, "datestamp_delta": 86400.000000 }
|
||||
{ "n": 5, "date": "2012-03-09", "qoh": 10880, "datestamp": 1331251200.000000, "datestamp_delta": 86400.000000 }
|
||||
{ "n": 6, "date": "2012-03-10", "qoh": 10718, "datestamp": 1331337600.000000, "datestamp_delta": 86400.000000 }
|
||||
{ "n": 7, "date": "2012-03-11", "qoh": 10795, "datestamp": 1331424000.000000, "datestamp_delta": 86400.000000 }
|
||||
{ "n": 8, "date": "2012-03-12", "qoh": 11043, "datestamp": 1331510400.000000, "datestamp_delta": 86400.000000 }
|
||||
{ "n": 9, "date": "2012-03-13", "qoh": 11177, "datestamp": 1331596800.000000, "datestamp_delta": 86400.000000 }
|
||||
{ "n": 10, "date": "2012-03-14", "qoh": 11498, "datestamp": 1331683200.000000, "datestamp_delta": 86400.000000 }
|
||||
n=1,date=2012-03-05,qoh=10055,datestamp=1330905600.000000,datestamp_delta=0
|
||||
n=2,date=2012-03-06,qoh=10486,datestamp=1330992000.000000,datestamp_delta=86400.000000
|
||||
n=3,date=2012-03-07,qoh=10430,datestamp=1331078400.000000,datestamp_delta=86400.000000
|
||||
n=4,date=2012-03-08,qoh=10674,datestamp=1331164800.000000,datestamp_delta=86400.000000
|
||||
n=5,date=2012-03-09,qoh=10880,datestamp=1331251200.000000,datestamp_delta=86400.000000
|
||||
n=6,date=2012-03-10,qoh=10718,datestamp=1331337600.000000,datestamp_delta=86400.000000
|
||||
n=7,date=2012-03-11,qoh=10795,datestamp=1331424000.000000,datestamp_delta=86400.000000
|
||||
n=8,date=2012-03-12,qoh=11043,datestamp=1331510400.000000,datestamp_delta=86400.000000
|
||||
n=9,date=2012-03-13,qoh=11177,datestamp=1331596800.000000,datestamp_delta=86400.000000
|
||||
n=10,date=2012-03-14,qoh=11498,datestamp=1331683200.000000,datestamp_delta=86400.000000
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -900,8 +901,8 @@ $ mlr --from data/miss-date.csv --icsv \
|
|||
then put '$datestamp = strptime($date, "%Y-%m-%d")' \
|
||||
then step -a delta -f datestamp \
|
||||
then filter '$datestamp_delta != 86400 && $n != 1'
|
||||
{ "n": 774, "date": "2014-04-19", "qoh": 130140, "datestamp": 1397865600.000000, "datestamp_delta": 259200.000000 }
|
||||
{ "n": 1119, "date": "2015-03-31", "qoh": 181625, "datestamp": 1427760000.000000, "datestamp_delta": 172800.000000 }
|
||||
n=774,date=2014-04-19,qoh=130140,datestamp=1397865600.000000,datestamp_delta=259200.000000
|
||||
n=1119,date=2015-03-31,qoh=181625,datestamp=1427760000.000000,datestamp_delta=172800.000000
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -912,17 +913,17 @@ $ mlr --from data/miss-date.csv --icsv \
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cat -n then filter '$n >= 770 && $n <= 780' data/miss-date.csv
|
||||
{ "n": 770, "1": "2014-04-12", "2": 129435 }
|
||||
{ "n": 771, "1": "2014-04-13", "2": 129868 }
|
||||
{ "n": 772, "1": "2014-04-14", "2": 129797 }
|
||||
{ "n": 773, "1": "2014-04-15", "2": 129919 }
|
||||
{ "n": 774, "1": "2014-04-16", "2": 130181 }
|
||||
{ "n": 775, "1": "2014-04-19", "2": 130140 }
|
||||
{ "n": 776, "1": "2014-04-20", "2": 130271 }
|
||||
{ "n": 777, "1": "2014-04-21", "2": 130368 }
|
||||
{ "n": 778, "1": "2014-04-22", "2": 130368 }
|
||||
{ "n": 779, "1": "2014-04-23", "2": 130849 }
|
||||
{ "n": 780, "1": "2014-04-24", "2": 131026 }
|
||||
n=770,1=2014-04-12,2=129435
|
||||
n=771,1=2014-04-13,2=129868
|
||||
n=772,1=2014-04-14,2=129797
|
||||
n=773,1=2014-04-15,2=129919
|
||||
n=774,1=2014-04-16,2=130181
|
||||
n=775,1=2014-04-19,2=130140
|
||||
n=776,1=2014-04-20,2=130271
|
||||
n=777,1=2014-04-21,2=130368
|
||||
n=778,1=2014-04-22,2=130368
|
||||
n=779,1=2014-04-23,2=130849
|
||||
n=780,1=2014-04-24,2=131026
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -930,17 +931,17 @@ $ mlr cat -n then filter '$n >= 770 && $n <= 780' data/miss-date.c
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cat -n then filter '$n >= 1115 && $n <= 1125' data/miss-date.csv
|
||||
{ "n": 1115, "1": "2015-03-25", "2": 181006 }
|
||||
{ "n": 1116, "1": "2015-03-26", "2": 180995 }
|
||||
{ "n": 1117, "1": "2015-03-27", "2": 181043 }
|
||||
{ "n": 1118, "1": "2015-03-28", "2": 181112 }
|
||||
{ "n": 1119, "1": "2015-03-29", "2": 181306 }
|
||||
{ "n": 1120, "1": "2015-03-31", "2": 181625 }
|
||||
{ "n": 1121, "1": "2015-04-01", "2": 181494 }
|
||||
{ "n": 1122, "1": "2015-04-02", "2": 181718 }
|
||||
{ "n": 1123, "1": "2015-04-03", "2": 181835 }
|
||||
{ "n": 1124, "1": "2015-04-04", "2": 182104 }
|
||||
{ "n": 1125, "1": "2015-04-05", "2": 182528 }
|
||||
n=1115,1=2015-03-25,2=181006
|
||||
n=1116,1=2015-03-26,2=180995
|
||||
n=1117,1=2015-03-27,2=181043
|
||||
n=1118,1=2015-03-28,2=181112
|
||||
n=1119,1=2015-03-29,2=181306
|
||||
n=1120,1=2015-03-31,2=181625
|
||||
n=1121,1=2015-04-01,2=181494
|
||||
n=1122,1=2015-04-02,2=181718
|
||||
n=1123,1=2015-04-03,2=181835
|
||||
n=1124,1=2015-04-04,2=182104
|
||||
n=1125,1=2015-04-05,2=182528
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1215,13 +1216,13 @@ $ mlr --from data/rect.txt put -q '
|
|||
is_present($inner1) {
|
||||
emit @r
|
||||
}'
|
||||
{ "outer": 1, "middle": 10, "inner1": 100, "inner2": 101 }
|
||||
{ "outer": 1, "middle": 12, "inner1": 120, "inner2": 121 }
|
||||
{ "outer": 2, "middle": 20, "inner1": 200, "inner2": 201 }
|
||||
{ "outer": 2, "middle": 21, "inner1": 210, "inner2": 211 }
|
||||
{ "outer": 3, "middle": 30, "inner1": 300, "inner2": 301 }
|
||||
{ "outer": 3, "middle": 31, "inner1": 312, "inner2": 301 }
|
||||
{ "outer": 3, "middle": 31, "inner1": 313, "inner2": 314 }
|
||||
outer=1,middle=10,inner1=100,inner2=101
|
||||
outer=1,middle=12,inner1=120,inner2=121
|
||||
outer=2,middle=20,inner1=200,inner2=201
|
||||
outer=2,middle=21,inner1=210,inner2=211
|
||||
outer=3,middle=30,inner1=300,inner2=301
|
||||
outer=3,middle=31,inner1=312,inner2=301
|
||||
outer=3,middle=31,inner1=313,inner2=314
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ pageTracker._trackPageview();
|
|||
|
||||
<br/>
|
||||
<br/><a href="faq.html">FAQ</a>
|
||||
<br/><a href="customization.html">Customization</a>
|
||||
<br/><a href="data-sharing.html">Mixing with other languages</a>
|
||||
<br/><a href="cookbook.html">Cookbook part 1</a>
|
||||
<br/><a href="cookbook2.html"><b>Cookbook part 2</b></a>
|
||||
|
|
@ -285,11 +286,11 @@ $ mlr --from data/medium put -q '
|
|||
#emit mean, "a";
|
||||
emit (wmean, mean), "a";
|
||||
}'
|
||||
{ "a": "pan", "wmean": 4979.563722, "mean": 5028.259010 }
|
||||
{ "a": "eks", "wmean": 4890.381593, "mean": 4956.290076 }
|
||||
{ "a": "wye", "wmean": 4946.987746, "mean": 4920.001017 }
|
||||
{ "a": "zee", "wmean": 5164.719685, "mean": 5123.092330 }
|
||||
{ "a": "hat", "wmean": 4925.533162, "mean": 4967.743946 }
|
||||
a=pan,wmean=4979.563722,mean=5028.259010
|
||||
a=eks,wmean=4890.381593,mean=4956.290076
|
||||
a=wye,wmean=4946.987746,mean=4920.001017
|
||||
a=zee,wmean=5164.719685,mean=5123.092330
|
||||
a=hat,wmean=4925.533162,mean=4967.743946
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ pageTracker._trackPageview();
|
|||
|
||||
<br/>
|
||||
<br/><a href="faq.html">FAQ</a>
|
||||
<br/><a href="customization.html">Customization</a>
|
||||
<br/><a href="data-sharing.html">Mixing with other languages</a>
|
||||
<br/><a href="cookbook.html">Cookbook part 1</a>
|
||||
<br/><a href="cookbook2.html">Cookbook part 2</a>
|
||||
|
|
|
|||
233
doc/customization.html
Normal file
233
doc/customization.html
Normal file
|
|
@ -0,0 +1,233 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<!-- PAGE GENERATED FROM template.html and content-for-customization.html BY poki. -->
|
||||
<!-- PLEASE MAKE CHANGES THERE AND THEN RE-RUN poki. -->
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
|
||||
<meta name="description" content="Miller documentation"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <!-- mobile-friendly -->
|
||||
<meta name="keywords"
|
||||
content="John Kerl, Kerl, Miller, miller, mlr, OLAP, data analysis software, regression, correlation, variance, data tools, " />
|
||||
|
||||
<title> Customization </title>
|
||||
<link rel="stylesheet" type="text/css" href="css/miller.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="css/poki-callbacks.css"/>
|
||||
</head>
|
||||
|
||||
<!-- ================================================================ -->
|
||||
<script type="text/javascript">
|
||||
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
|
||||
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
try {
|
||||
var pageTracker = _gat._getTracker("UA-15651652-1");
|
||||
pageTracker._trackPageview();
|
||||
} catch(err) {}
|
||||
</script>
|
||||
<!-- ================================================================ -->
|
||||
|
||||
<body bgcolor="#ffffff">
|
||||
|
||||
<!-- ================================================================ -->
|
||||
|
||||
<!-- navbar -->
|
||||
<div class="pokinav">
|
||||
<center><titleinbody>Miller</titleinbody></center>
|
||||
|
||||
<!-- NAVBAR GENERATED FROM template.html BY poki -->
|
||||
<br/>
|
||||
<a class="poki-navbar-element" href="index.html">Overview</a>
|
||||
|
||||
<a class="poki-navbar-element" href="faq.html"><b>Using</b></a>
|
||||
|
||||
<a class="poki-navbar-element" href="reference.html">Reference</a>
|
||||
|
||||
<a class="poki-navbar-element" href="why.html">Background</a>
|
||||
|
||||
<a class="poki-navbar-element" href="contact.html">Repository</a>
|
||||
|
||||
<br/>
|
||||
<br/><a href="faq.html">FAQ</a>
|
||||
<br/><a href="customization.html"><b>Customization</b></a>
|
||||
<br/><a href="data-sharing.html">Mixing with other languages</a>
|
||||
<br/><a href="cookbook.html">Cookbook part 1</a>
|
||||
<br/><a href="cookbook2.html">Cookbook part 2</a>
|
||||
<br/><a href="cookbook3.html">Cookbook part 3</a>
|
||||
<br/><a href="data-examples.html">Data-diving examples</a>
|
||||
</div>
|
||||
|
||||
<!-- page body -->
|
||||
<p/>
|
||||
|
||||
<!-- BODY COPIED FROM content-for-customization.html BY poki -->
|
||||
<div class="pokitoc">
|
||||
<center><titleinbody>Customization</titleinbody></center>
|
||||
• <a href="#How_to_use_.mlrrc">How to use .mlrrc</a><br/>
|
||||
• <a href="#What_you_can_put_in_your_.mlrrc">What you can put in your .mlrrc</a><br/>
|
||||
• <a href="#Where_to_put_your_.mlrrc">Where to put your .mlrrc</a><br/>
|
||||
</div>
|
||||
<p/>
|
||||
|
||||
<p/>
|
||||
<button style="font-weight:bold;color:maroon;border:0" onclick="bodyToggler.expandAll();" href="javascript:;">Expand all sections</button>
|
||||
<button style="font-weight:bold;color:maroon;border:0" onclick="bodyToggler.collapseAll();" href="javascript:;">Collapse all sections</button>
|
||||
|
||||
<a id="How_to_use_.mlrrc"/><h1>How to use .mlrrc</h1>
|
||||
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="bodyToggler.toggle('body_section_toggle_how');" href="javascript:;">Toggle section visibility</button>
|
||||
<div id="body_section_toggle_how" style="display: block">
|
||||
|
||||
<p>Suppose you always use CSV files. Then instead of always having to type
|
||||
<tt>--csv</tt> as in </p>
|
||||
|
||||
<p/>
|
||||
<div class="pokipanel">
|
||||
<pre>
|
||||
mlr --csv cut -x -f extra mydata.csv
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
||||
<p/>
|
||||
<div class="pokipanel">
|
||||
<pre>
|
||||
mlr --csv sort -n id mydata.csv
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
||||
<p>and so on, you can instead put the following into your <tt>$HOME/.mlrrc</tt>:</p>
|
||||
|
||||
<p/>
|
||||
<div class="pokipanel">
|
||||
<pre>
|
||||
--csv
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
||||
<p>Then you can just type things like</p>
|
||||
|
||||
<p/>
|
||||
<div class="pokipanel">
|
||||
<pre>
|
||||
mlr cut -x -f extra mydata.csv
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
||||
<p/>
|
||||
<div class="pokipanel">
|
||||
<pre>
|
||||
mlr sort -n id mydata.csv
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
||||
<p>and the <tt>--csv</tt> part will automatically be understood. (If you do
|
||||
want to process, say, a JSON file then <tt>mlr --json ...</tt> at the command
|
||||
line will override the default from your <tt>.mlrrc</tt>.)</p>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<a id="What_you_can_put_in_your_.mlrrc"/><h1>What you can put in your .mlrrc</h1>
|
||||
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="bodyToggler.toggle('body_section_toggle_what');" href="javascript:;">Toggle section visibility</button>
|
||||
<div id="body_section_toggle_what" style="display: block">
|
||||
|
||||
<ul>
|
||||
|
||||
<li>You can include any command-line flags, except the "terminal" ones such
|
||||
as <tt>--help</tt>. </li>
|
||||
|
||||
<li>The formatting rule is you need to put one flag beginning with
|
||||
<tt>--</tt> per line: for example, <tt>--csv</tt> on one line and
|
||||
<tt>--nr-progress-mod 1000</tt> on a separate line. </li>
|
||||
|
||||
<li>Since every line starts with a <tt>--</tt> option, you can leave off the
|
||||
initial <tt>--</tt> if you want. For example, <tt>ojson</tt> is the same as
|
||||
<tt>--ojson</tt>, and <tt>nr-progress-mod 1000</tt> is the same as
|
||||
<tt>--nr-progress-mod 1000</tt>.
|
||||
|
||||
<li>Comments are from a <tt>#</tt> to the end of the line.</li>
|
||||
|
||||
<li>Empty lines are ignored -- including lines which are empty after comments are removed.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<p>Here is an example <tt>.mlrrc file</tt>:
|
||||
|
||||
<p/>
|
||||
<div class="pokipanel">
|
||||
<pre>
|
||||
# These are my preferred default settings for Miller
|
||||
|
||||
# Input and output formats are CSV by default (unless otherwise specified
|
||||
# on the mlr command line):
|
||||
csv
|
||||
|
||||
# If a data line has fewer fields than the header line, instead of erroring
|
||||
# (which is the default), just insert empty values for the missing ones:
|
||||
allow-ragged-csv-input
|
||||
|
||||
# These are no-ops for CSV, but when I do use JSON output, I want these
|
||||
# pretty-printing options to be used:
|
||||
jvstack
|
||||
jlistwrap
|
||||
|
||||
# Use "@", rather than "#", for comments within data files:
|
||||
skip-comments-with @
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
||||
</div>
|
||||
|
||||
<a id="Where_to_put_your_.mlrrc"/><h1>Where to put your .mlrrc</h1>
|
||||
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="bodyToggler.toggle('body_section_toggle_where');" href="javascript:;">Toggle section visibility</button>
|
||||
<div id="body_section_toggle_where" style="display: block">
|
||||
|
||||
<ul>
|
||||
|
||||
<li>If the environment variable <tt>MLRRC</tt> is set:</li>
|
||||
|
||||
<ul>
|
||||
<li>If its value is <tt>__none__</tt> then no <tt>.mlrrc</tt> files are processed.
|
||||
(This is nice for things like regression testing.)</li>
|
||||
<li>Otherwise, its value (as a filename) is loaded and processed. If there
|
||||
are syntax errors, they abort <tt>mlr</tt> with a usage message (as if
|
||||
you had mistyped something on the command line). If the file can't be loaded at
|
||||
all, though, it is silently skipped.</li>
|
||||
<li>Any <tt>.mlrrc</tt> in your home directory or current directory is ignored whenever
|
||||
<tt>MLRRC</tt> is set in the environment.
|
||||
</ul>
|
||||
|
||||
<li>Otherwise:
|
||||
|
||||
<ul>
|
||||
<li>If <tt>$HOME/.mlrrc</tt> exists, it’s processed as above.</li>
|
||||
<li>If <tt>./.mlrrc</tt> exists, it’s then also processed as above.</li>
|
||||
<li>The idea is you can have all your settings in your <tt>$HOME/.mlrrc</tt>,
|
||||
then override maybe one or two for your current directory if you like.</li>
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ================================================================ -->
|
||||
<script type="text/javascript" src="js/miller-doc-toggler.js"></script>
|
||||
<!-- wtf -->
|
||||
<script type="text/javascript">
|
||||
// Put this at the bottom of the page since its constructor scans the
|
||||
// document's div tags to find the toggleables.
|
||||
const bodyToggler = new MillerDocToggler(
|
||||
"body_section_toggle_",
|
||||
'maroon',
|
||||
'maroon',
|
||||
);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -50,6 +50,7 @@ pageTracker._trackPageview();
|
|||
|
||||
<br/>
|
||||
<br/><a href="faq.html">FAQ</a>
|
||||
<br/><a href="customization.html">Customization</a>
|
||||
<br/><a href="data-sharing.html">Mixing with other languages</a>
|
||||
<br/><a href="cookbook.html">Cookbook part 1</a>
|
||||
<br/><a href="cookbook2.html">Cookbook part 2</a>
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ pageTracker._trackPageview();
|
|||
|
||||
<br/>
|
||||
<br/><a href="faq.html">FAQ</a>
|
||||
<br/><a href="customization.html">Customization</a>
|
||||
<br/><a href="data-sharing.html"><b>Mixing with other languages</b></a>
|
||||
<br/><a href="cookbook.html">Cookbook part 1</a>
|
||||
<br/><a href="cookbook2.html">Cookbook part 2</a>
|
||||
|
|
|
|||
37
doc/faq.html
37
doc/faq.html
|
|
@ -50,6 +50,7 @@ pageTracker._trackPageview();
|
|||
|
||||
<br/>
|
||||
<br/><a href="faq.html"><b>FAQ</b></a>
|
||||
<br/><a href="customization.html">Customization</a>
|
||||
<br/><a href="data-sharing.html">Mixing with other languages</a>
|
||||
<br/><a href="cookbook.html">Cookbook part 1</a>
|
||||
<br/><a href="cookbook2.html">Cookbook part 2</a>
|
||||
|
|
@ -596,7 +597,7 @@ Name=Khavari, Darius^ARole=tester
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'x.a=3,y:b=4,z/c=5' | mlr put '${product.all} = ${x.a} * ${y:b} * ${z/c}'
|
||||
{ "x.a": 3, "y": {"b": 4 },"z/c": 5, "product.all": 60 }
|
||||
x.a=3,y:b=4,z/c=5,product.all=60
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -660,7 +661,7 @@ $a = "It's OK, I said, then 'for now'."
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo a=bcd | mlr put -f data/single-quote-example.mlr
|
||||
{ "a": "It's OK, I said, then 'for now'." }
|
||||
a=It's OK, I said, then 'for now'.
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -675,7 +676,7 @@ strings, no problem.
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo a=bcd | mlr put '$a="It'\''s OK, I said, '\''for now'\''."'
|
||||
{ "a": "It's OK, I said, 'for now'." }
|
||||
a=It's OK, I said, 'for now'.
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -720,11 +721,11 @@ a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cut -f x,i,a data/small
|
||||
{ "a": "pan", "i": 1, "x": 0.3467901443380824 }
|
||||
{ "a": "eks", "i": 2, "x": 0.7586799647899636 }
|
||||
{ "a": "wye", "i": 3, "x": 0.20460330576630303 }
|
||||
{ "a": "eks", "i": 4, "x": 0.38139939387114097 }
|
||||
{ "a": "wye", "i": 5, "x": 0.5732889198020006 }
|
||||
a=pan,i=1,x=0.3467901443380824
|
||||
a=eks,i=2,x=0.7586799647899636
|
||||
a=wye,i=3,x=0.20460330576630303
|
||||
a=eks,i=4,x=0.38139939387114097
|
||||
a=wye,i=5,x=0.5732889198020006
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -739,11 +740,11 @@ command, which has the same semantics.
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cut -o -f x,i,a data/small
|
||||
{ "x": 0.3467901443380824, "i": 1, "a": "pan" }
|
||||
{ "x": 0.7586799647899636, "i": 2, "a": "eks" }
|
||||
{ "x": 0.20460330576630303, "i": 3, "a": "wye" }
|
||||
{ "x": 0.38139939387114097, "i": 4, "a": "eks" }
|
||||
{ "x": 0.5732889198020006, "i": 5, "a": "wye" }
|
||||
x=0.3467901443380824,i=1,a=pan
|
||||
x=0.7586799647899636,i=2,a=eks
|
||||
x=0.20460330576630303,i=3,a=wye
|
||||
x=0.38139939387114097,i=4,a=eks
|
||||
x=0.5732889198020006,i=5,a=wye
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -773,8 +774,8 @@ why don’t I see <code>NR=1</code> and <code>NR=2</code> here??
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr filter '$x > 0.5' then put '$NR = NR' data/small
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "NR": 2 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "NR": 5 }
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,NR=2
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,NR=5
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -787,7 +788,7 @@ current record, and if you add/remove a field, the value of <code>NF</code> will
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo x=1,y=2,z=3 | mlr put '$nf1 = NF; $u = 4; $nf2 = NF; unset $x,$y,$z; $nf3 = NF'
|
||||
{ "nf1": 3, "u": 4, "nf2": 5, "nf3": 3 }
|
||||
nf1=3,u=4,nf2=5,nf3=3
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -823,8 +824,8 @@ wye pan 5 0.5732889198020006 0.8636244699032729 5 2
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr filter '$x > 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 }
|
||||
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/>
|
||||
|
|
|
|||
|
|
@ -255,11 +255,11 @@ Miller’s default file format is DKVP, for <b>delimited key-value pairs</b>
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cat data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@
|
|||
"external_name": "FAQ",
|
||||
"file_name": "faq.html"
|
||||
},
|
||||
{
|
||||
"external_name": "Customization",
|
||||
"file_name": "customization.html"
|
||||
},
|
||||
{
|
||||
"external_name": "Mixing with other languages",
|
||||
"file_name": "data-sharing.html"
|
||||
|
|
|
|||
|
|
@ -320,13 +320,13 @@ count=450
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr sort -n count data/sort-het.dkvp
|
||||
{ "count": 100, "color": "green" }
|
||||
{ "status": "ok", "count": 200, "hours": 3.4 }
|
||||
{ "status": "ok", "count": 250, "hours": 0.22 }
|
||||
{ "count": 300, "color": "blue" }
|
||||
{ "count": 450 }
|
||||
{ "count": 500, "color": "green" }
|
||||
{ "count": 600 }
|
||||
count=100,color=green
|
||||
status=ok,count=200,hours=3.4
|
||||
status=ok,count=250,hours=0.22
|
||||
count=300,color=blue
|
||||
count=450
|
||||
count=500,color=green
|
||||
count=600
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
|
|||
|
|
@ -131,9 +131,9 @@ pageTracker._trackPageview();
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr stats1 -a sum -f x -g a data/small
|
||||
{ "a": "pan", "x_sum": 0.346790 }
|
||||
{ "a": "eks", "x_sum": 1.140079 }
|
||||
{ "a": "wye", "x_sum": 0.777892 }
|
||||
a=pan,x_sum=0.346790
|
||||
a=eks,x_sum=1.140079
|
||||
a=wye,x_sum=0.777892
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -152,9 +152,9 @@ $ mlr stats1 -a sum -f x -g a data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@x_sum[$a] += $x; end{emit @x_sum, "a"}' data/small
|
||||
{ "a": "pan", "x_sum": 0.346790 }
|
||||
{ "a": "eks", "x_sum": 1.140079 }
|
||||
{ "a": "wye", "x_sum": 0.777892 }
|
||||
a=pan,x_sum=0.346790
|
||||
a=eks,x_sum=1.140079
|
||||
a=wye,x_sum=0.777892
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -194,8 +194,8 @@ a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr filter '$a == "eks"' data/small
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -206,11 +206,11 @@ $ mlr filter '$a == "eks"' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$ab = $a . "_" . $b ' data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533, "ab": "pan_pan" }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "ab": "eks_pan" }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "ab": "wye_wye" }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463, "ab": "eks_wye" }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "ab": "wye_pan" }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,ab=pan_pan
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,ab=eks_pan
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,ab=wye_wye
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,ab=eks_wye
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,ab=wye_pan
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -314,11 +314,11 @@ x_y_corr
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr --from data/small put '$xy = sqrt($x**2 + $y**2)'
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533, "xy": 0.805299 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "xy": 0.920998 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "xy": 0.395376 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463, "xy": 0.404317 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "xy": 1.036584 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,xy=0.805299
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,xy=0.920998
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,xy=0.395376
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,xy=0.404317
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,xy=1.036584
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -326,11 +326,11 @@ $ mlr --from data/small put '$xy = sqrt($x**2 + $y**2)'
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr --from data/small put 'func f(a, b) { return sqrt(a**2 + b**2) } $xy = f($x, $y)'
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533, "xy": 0.805299 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "xy": 0.920998 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "xy": 0.395376 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463, "xy": 0.404317 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "xy": 1.036584 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,xy=0.805299
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,xy=0.920998
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,xy=0.395376
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,xy=0.404317
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,xy=1.036584
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -353,11 +353,11 @@ $xy = f($x, $y)
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr --from data/small put -f data/fe-example-3.mlr
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533, "xy": 0.805299 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "xy": 0.920998 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "xy": 0.395376 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463, "xy": 0.404317 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "xy": 1.036584 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,xy=0.805299
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,xy=0.920998
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,xy=0.395376
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,xy=0.404317
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,xy=1.036584
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -379,11 +379,11 @@ func f(a, b) {
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr --from data/small put -f data/fe-example-4.mlr -e '$xy = f($x, $y)'
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533, "xy": 0.805299 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "xy": 0.920998 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "xy": 0.395376 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463, "xy": 0.404317 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "xy": 1.036584 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,xy=0.805299
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,xy=0.920998
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,xy=0.395376
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,xy=0.404317
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,xy=1.036584
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -424,7 +424,7 @@ mlr put 'x=1;;;;$y=2;'
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo x=1,y=2 | mlr put 'while (NF < 10) { $[NF+1] = ""} $foo = "bar"'
|
||||
{ "x": 1, "y": 2, "3": "", "4": "", "5": "", "6": "", "7": "", "8": "", "9": "", "10": "", "foo": "bar" }
|
||||
x=1,y=2,3=,4=,5=,6=,7=,8=,9=,10=,foo=bar
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -432,7 +432,7 @@ $ echo x=1,y=2 | mlr put 'while (NF < 10) { $[NF+1] = ""} $foo = "bar"'
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo x=1,y=2 | mlr put 'while (NF < 10) { $[NF+1] = ""}; $foo = "bar"'
|
||||
{ "x": 1, "y": 2, "3": "", "4": "", "5": "", "6": "", "7": "", "8": "", "9": "", "10": "", "foo": "bar" }
|
||||
x=1,y=2,3=,4=,5=,6=,7=,8=,9=,10=,foo=bar
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -569,9 +569,9 @@ variables, e.g. <code>ENV["HOME"]</code> or <code>ENV["foo_".$hostname]</code>.
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr filter 'FNR == 2' data/small*
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "1": "pan", "2": "pan", "3": 1, "4": 0.3467901443380824, "5": 0.7268028627434533 }
|
||||
{ "a": "wye", "b": "eks", "i": 10000, "x": 0.734806020620654365, "y": 0.884788571337605134 }
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
1=pan,2=pan,3=1,4=0.3467901443380824,5=0.7268028627434533
|
||||
a=wye,b=eks,i=10000,x=0.734806020620654365,y=0.884788571337605134
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -580,22 +580,22 @@ $ mlr filter 'FNR == 2' data/small*
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$fnr = FNR' data/small*
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533, "fnr": 1 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "fnr": 2 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "fnr": 3 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463, "fnr": 4 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "fnr": 5 }
|
||||
{ "1": "a", "2": "b", "3": "i", "4": "x", "5": "y", "fnr": 1 }
|
||||
{ "1": "pan", "2": "pan", "3": 1, "4": 0.3467901443380824, "5": 0.7268028627434533, "fnr": 2 }
|
||||
{ "1": "eks", "2": "pan", "3": 2, "4": 0.7586799647899636, "5": 0.5221511083334797, "fnr": 3 }
|
||||
{ "1": "wye", "2": "wye", "3": 3, "4": 0.20460330576630303, "5": 0.33831852551664776, "fnr": 4 }
|
||||
{ "1": "eks", "2": "wye", "3": 4, "4": 0.38139939387114097, "5": 0.13418874328430463, "fnr": 5 }
|
||||
{ "1": "wye", "2": "pan", "3": 5, "4": 0.5732889198020006, "5": 0.8636244699032729, "fnr": 6 }
|
||||
{ "a": "pan", "b": "eks", "i": 9999, "x": 0.267481232652199086, "y": 0.557077185510228001, "fnr": 1 }
|
||||
{ "a": "wye", "b": "eks", "i": 10000, "x": 0.734806020620654365, "y": 0.884788571337605134, "fnr": 2 }
|
||||
{ "a": "pan", "b": "wye", "i": 10001, "x": 0.870530722602517626, "y": 0.009854780514656930, "fnr": 3 }
|
||||
{ "a": "hat", "b": "wye", "i": 10002, "x": 0.321507044286237609, "y": 0.568893318795083758, "fnr": 4 }
|
||||
{ "a": "pan", "b": "zee", "i": 10003, "x": 0.272054845593895200, "y": 0.425789896597056627, "fnr": 5 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,fnr=1
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,fnr=2
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,fnr=3
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,fnr=4
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,fnr=5
|
||||
1=a,2=b,3=i,4=x,5=y,fnr=1
|
||||
1=pan,2=pan,3=1,4=0.3467901443380824,5=0.7268028627434533,fnr=2
|
||||
1=eks,2=pan,3=2,4=0.7586799647899636,5=0.5221511083334797,fnr=3
|
||||
1=wye,2=wye,3=3,4=0.20460330576630303,5=0.33831852551664776,fnr=4
|
||||
1=eks,2=wye,3=4,4=0.38139939387114097,5=0.13418874328430463,fnr=5
|
||||
1=wye,2=pan,3=5,4=0.5732889198020006,5=0.8636244699032729,fnr=6
|
||||
a=pan,b=eks,i=9999,x=0.267481232652199086,y=0.557077185510228001,fnr=1
|
||||
a=wye,b=eks,i=10000,x=0.734806020620654365,y=0.884788571337605134,fnr=2
|
||||
a=pan,b=wye,i=10001,x=0.870530722602517626,y=0.009854780514656930,fnr=3
|
||||
a=hat,b=wye,i=10002,x=0.321507044286237609,y=0.568893318795083758,fnr=4
|
||||
a=pan,b=zee,i=10003,x=0.272054845593895200,y=0.425789896597056627,fnr=5
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -675,7 +675,7 @@ $ echo a=3,b=4 | mlr filter '$["x"] < 0.5'
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo s=green,t=blue,a=3,b=4 | mlr put '$[$s."_".$t] = $a * $b'
|
||||
{ "s": "green", "t": "blue", "a": 3, "b": 4, "green_blue": 12 }
|
||||
s=green,t=blue,a=3,b=4,green_blue=12
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -715,11 +715,11 @@ This has the shorter equivalent notation <code>$[[[3]]]</code>.
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cat data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -728,11 +728,11 @@ $ mlr cat data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$[[3]] = "NEW"' data/small
|
||||
{ "a": "pan", "b": "pan", "NEW": 1, "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "pan", "NEW": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "NEW": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "NEW": 4, "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "NEW": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
a=pan,b=pan,NEW=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=pan,NEW=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,NEW=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=wye,NEW=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
a=wye,b=pan,NEW=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -740,11 +740,11 @@ $ mlr put '$[[3]] = "NEW"' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$[[[3]]] = "NEW"' data/small
|
||||
{ "a": "pan", "b": "pan", "i": "NEW", "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "pan", "i": "NEW", "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": "NEW", "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "i": "NEW", "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "i": "NEW", "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
a=pan,b=pan,i=NEW,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=pan,i=NEW,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=NEW,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=wye,i=NEW,x=0.38139939387114097,y=0.13418874328430463
|
||||
a=wye,b=pan,i=NEW,x=0.5732889198020006,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -752,11 +752,11 @@ $ mlr put '$[[[3]]] = "NEW"' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$NEW = $[[NR]]' data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533, "NEW": "a" }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "NEW": "b" }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "NEW": "i" }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463, "NEW": "x" }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "NEW": "y" }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,NEW=a
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,NEW=b
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,NEW=i
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,NEW=x
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,NEW=y
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -764,11 +764,11 @@ $ mlr put '$NEW = $[[NR]]' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$NEW = $[[[NR]]]' data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533, "NEW": "pan" }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "NEW": "pan" }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776, "NEW": 3 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463, "NEW": 0.381399 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "NEW": 0.863624 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533,NEW=pan
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,NEW=pan
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776,NEW=3
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463,NEW=0.381399
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,NEW=0.863624
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -776,11 +776,11 @@ $ mlr put '$NEW = $[[[NR]]]' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$[[[NR]]] = "NEW"' data/small
|
||||
{ "a": "NEW", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "NEW", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": "NEW", "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": "NEW", "y": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": "NEW" }
|
||||
a=NEW,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=NEW,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=NEW,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=wye,i=4,x=NEW,y=0.13418874328430463
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=NEW
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -795,11 +795,11 @@ field results in a no-op.
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$[[6]] = "NEW"' data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -807,11 +807,11 @@ $ mlr put '$[[6]] = "NEW"' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$[[[6]]] = "NEW"' data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -839,7 +839,7 @@ with <b>special characters</b> such as <code>.</code> then you can use braces, e
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo s=green,t=blue,a=3,b=4 | mlr put -q '@[$s."_".$t] = $a * $b; emit all'
|
||||
{ "green_blue": 12 }
|
||||
green_blue=12
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -862,10 +862,10 @@ a=4,b=5,c=6
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '@sum += $a; end {emit @sum}' then put 'is_present($a) {$a=10*$a; @sum += $a}; end {emit @sum}' data/a.dkvp
|
||||
{ "a": 10, "b": 2, "c": 3 }
|
||||
{ "a": 40, "b": 5, "c": 6 }
|
||||
{ "sum": 5 }
|
||||
{ "sum": 50 }
|
||||
a=10,b=2,c=3
|
||||
a=40,b=5,c=6
|
||||
sum=5
|
||||
sum=50
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -893,16 +893,16 @@ $ mlr put -q '
|
|||
emit @x_sum, "a";
|
||||
}
|
||||
' ../data/small
|
||||
{ "a": "pan", "x_count": 2 }
|
||||
{ "a": "eks", "x_count": 3 }
|
||||
{ "a": "wye", "x_count": 2 }
|
||||
{ "a": "zee", "x_count": 2 }
|
||||
{ "a": "hat", "x_count": 1 }
|
||||
{ "a": "pan", "x_sum": 0.849416 }
|
||||
{ "a": "eks", "x_sum": 1.751863 }
|
||||
{ "a": "wye", "x_sum": 0.777892 }
|
||||
{ "a": "zee", "x_sum": 1.125680 }
|
||||
{ "a": "hat", "x_sum": 0.031442 }
|
||||
a=pan,x_count=2
|
||||
a=eks,x_count=3
|
||||
a=wye,x_count=2
|
||||
a=zee,x_count=2
|
||||
a=hat,x_count=1
|
||||
a=pan,x_sum=0.849416
|
||||
a=eks,x_sum=1.751863
|
||||
a=wye,x_sum=0.777892
|
||||
a=zee,x_sum=1.125680
|
||||
a=hat,x_sum=0.031442
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -910,11 +910,11 @@ $ mlr put -q '
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr stats1 -a count,sum -f x -g a ../data/small
|
||||
{ "a": "pan", "x_count": 2, "x_sum": 0.849416 }
|
||||
{ "a": "eks", "x_count": 3, "x_sum": 1.751863 }
|
||||
{ "a": "wye", "x_count": 2, "x_sum": 0.777892 }
|
||||
{ "a": "zee", "x_count": 2, "x_sum": 1.125680 }
|
||||
{ "a": "hat", "x_count": 1, "x_sum": 0.031442 }
|
||||
a=pan,x_count=2,x_sum=0.849416
|
||||
a=eks,x_count=3,x_sum=1.751863
|
||||
a=wye,x_count=2,x_sum=0.777892
|
||||
a=zee,x_count=2,x_sum=1.125680
|
||||
a=hat,x_count=1,x_sum=0.031442
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -931,31 +931,31 @@ $ mlr --from data/medium put -q '
|
|||
emit (@x_count, @x_sum), "a", "b";
|
||||
}
|
||||
'
|
||||
{ "a": "pan", "b": "pan", "x_count": 427, "x_sum": 219.185129 }
|
||||
{ "a": "pan", "b": "wye", "x_count": 395, "x_sum": 198.432931 }
|
||||
{ "a": "pan", "b": "eks", "x_count": 429, "x_sum": 216.075228 }
|
||||
{ "a": "pan", "b": "hat", "x_count": 417, "x_sum": 205.222776 }
|
||||
{ "a": "pan", "b": "zee", "x_count": 413, "x_sum": 205.097518 }
|
||||
{ "a": "eks", "b": "pan", "x_count": 371, "x_sum": 179.963030 }
|
||||
{ "a": "eks", "b": "wye", "x_count": 407, "x_sum": 196.945286 }
|
||||
{ "a": "eks", "b": "zee", "x_count": 357, "x_sum": 176.880365 }
|
||||
{ "a": "eks", "b": "eks", "x_count": 413, "x_sum": 215.916097 }
|
||||
{ "a": "eks", "b": "hat", "x_count": 417, "x_sum": 208.783171 }
|
||||
{ "a": "wye", "b": "wye", "x_count": 377, "x_sum": 185.295850 }
|
||||
{ "a": "wye", "b": "pan", "x_count": 392, "x_sum": 195.847900 }
|
||||
{ "a": "wye", "b": "hat", "x_count": 426, "x_sum": 212.033183 }
|
||||
{ "a": "wye", "b": "zee", "x_count": 385, "x_sum": 194.774048 }
|
||||
{ "a": "wye", "b": "eks", "x_count": 386, "x_sum": 204.812961 }
|
||||
{ "a": "zee", "b": "pan", "x_count": 389, "x_sum": 202.213804 }
|
||||
{ "a": "zee", "b": "wye", "x_count": 455, "x_sum": 233.991394 }
|
||||
{ "a": "zee", "b": "eks", "x_count": 391, "x_sum": 190.961778 }
|
||||
{ "a": "zee", "b": "zee", "x_count": 403, "x_sum": 206.640635 }
|
||||
{ "a": "zee", "b": "hat", "x_count": 409, "x_sum": 191.300006 }
|
||||
{ "a": "hat", "b": "wye", "x_count": 423, "x_sum": 208.883010 }
|
||||
{ "a": "hat", "b": "zee", "x_count": 385, "x_sum": 196.349450 }
|
||||
{ "a": "hat", "b": "eks", "x_count": 389, "x_sum": 189.006793 }
|
||||
{ "a": "hat", "b": "hat", "x_count": 381, "x_sum": 182.853532 }
|
||||
{ "a": "hat", "b": "pan", "x_count": 363, "x_sum": 168.553807 }
|
||||
a=pan,b=pan,x_count=427,x_sum=219.185129
|
||||
a=pan,b=wye,x_count=395,x_sum=198.432931
|
||||
a=pan,b=eks,x_count=429,x_sum=216.075228
|
||||
a=pan,b=hat,x_count=417,x_sum=205.222776
|
||||
a=pan,b=zee,x_count=413,x_sum=205.097518
|
||||
a=eks,b=pan,x_count=371,x_sum=179.963030
|
||||
a=eks,b=wye,x_count=407,x_sum=196.945286
|
||||
a=eks,b=zee,x_count=357,x_sum=176.880365
|
||||
a=eks,b=eks,x_count=413,x_sum=215.916097
|
||||
a=eks,b=hat,x_count=417,x_sum=208.783171
|
||||
a=wye,b=wye,x_count=377,x_sum=185.295850
|
||||
a=wye,b=pan,x_count=392,x_sum=195.847900
|
||||
a=wye,b=hat,x_count=426,x_sum=212.033183
|
||||
a=wye,b=zee,x_count=385,x_sum=194.774048
|
||||
a=wye,b=eks,x_count=386,x_sum=204.812961
|
||||
a=zee,b=pan,x_count=389,x_sum=202.213804
|
||||
a=zee,b=wye,x_count=455,x_sum=233.991394
|
||||
a=zee,b=eks,x_count=391,x_sum=190.961778
|
||||
a=zee,b=zee,x_count=403,x_sum=206.640635
|
||||
a=zee,b=hat,x_count=409,x_sum=191.300006
|
||||
a=hat,b=wye,x_count=423,x_sum=208.883010
|
||||
a=hat,b=zee,x_count=385,x_sum=196.349450
|
||||
a=hat,b=eks,x_count=389,x_sum=189.006793
|
||||
a=hat,b=hat,x_count=381,x_sum=182.853532
|
||||
a=hat,b=pan,x_count=363,x_sum=168.553807
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -984,12 +984,12 @@ $ mlr put '
|
|||
emitf @num_total, @num_positive
|
||||
}
|
||||
' data/put-gating-example-1.dkvp
|
||||
{ "x": -1 }
|
||||
{ "x": 0 }
|
||||
{ "x": 1, "y": 0.000000, "z": 0.000000 }
|
||||
{ "x": 2, "y": 0.301030, "z": 0.548662 }
|
||||
{ "x": 3, "y": 0.477121, "z": 0.690740 }
|
||||
{ "num_total": 5, "num_positive": 3 }
|
||||
x=-1
|
||||
x=0
|
||||
x=1,y=0.000000,z=0.000000
|
||||
x=2,y=0.301030,z=0.548662
|
||||
x=3,y=0.477121,z=0.690740
|
||||
num_total=5,num_positive=3
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1027,16 +1027,16 @@ mlr --seed 12345 seqgen --start 1 --stop 10 then put '
|
|||
num o = f(10, 20); # local to the top-level scope
|
||||
$o = o;
|
||||
'
|
||||
{ "i": 1, "o": 14.662901 }
|
||||
{ "i": 2, "o": 17.881983 }
|
||||
{ "i": 3, "o": 14.586560 }
|
||||
{ "i": 4, "o": 16.402409 }
|
||||
{ "i": 5, "o": 16.336598 }
|
||||
{ "i": 6, "o": 14.622701 }
|
||||
{ "i": 7, "o": 15.983753 }
|
||||
{ "i": 8, "o": 13.852177 }
|
||||
{ "i": 9, "o": 15.472899 }
|
||||
{ "i": 10, "o": 15.643912 }
|
||||
i=1,o=14.662901
|
||||
i=2,o=17.881983
|
||||
i=3,o=14.586560
|
||||
i=4,o=16.402409
|
||||
i=5,o=16.336598
|
||||
i=6,o=14.622701
|
||||
i=7,o=15.983753
|
||||
i=8,o=13.852177
|
||||
i=9,o=15.472899
|
||||
i=10,o=15.643912
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1276,11 +1276,11 @@ $ mlr --from data/small put '
|
|||
}
|
||||
$* = f({"a": $a, "x": $x});
|
||||
'
|
||||
{ "a": "pan", "x": 69.358029 }
|
||||
{ "a": "eks", "x": 151.735993 }
|
||||
{ "a": "wye", "x": 40.920661 }
|
||||
{ "a": "eks", "x": 76.279879 }
|
||||
{ "a": "wye", "x": 114.657784 }
|
||||
a=pan,x=69.358029
|
||||
a=eks,x=151.735993
|
||||
a=wye,x=40.920661
|
||||
a=eks,x=76.279879
|
||||
a=wye,x=114.657784
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1552,11 +1552,11 @@ $ mlr --opprint put -q '@v["sum"] += $x; @v["count"] += 1; end{dump; @w = @v; du
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put 'NR == 2 {@keep = $*}; NR == 4 {$* = @keep}' data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1970,11 +1970,11 @@ domain restrictions, regex-matching, and so on:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cat data/put-gating-example-1.dkvp
|
||||
{ "x": -1 }
|
||||
{ "x": 0 }
|
||||
{ "x": 1 }
|
||||
{ "x": 2 }
|
||||
{ "x": 3 }
|
||||
x=-1
|
||||
x=0
|
||||
x=1
|
||||
x=2
|
||||
x=3
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1982,11 +1982,11 @@ $ mlr cat data/put-gating-example-1.dkvp
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$x > 0.0 { $y = log10($x); $z = sqrt($y) }' data/put-gating-example-1.dkvp
|
||||
{ "x": -1 }
|
||||
{ "x": 0 }
|
||||
{ "x": 1, "y": 0.000000, "z": 0.000000 }
|
||||
{ "x": 2, "y": 0.301030, "z": 0.548662 }
|
||||
{ "x": 3, "y": 0.477121, "z": 0.690740 }
|
||||
x=-1
|
||||
x=0
|
||||
x=1,y=0.000000,z=0.000000
|
||||
x=2,y=0.301030,z=0.548662
|
||||
x=3,y=0.477121,z=0.690740
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1994,9 +1994,9 @@ $ mlr put '$x > 0.0 { $y = log10($x); $z = sqrt($y) }' data/put-gating-exampl
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cat data/put-gating-example-2.dkvp
|
||||
{ "a": "abc_123" }
|
||||
{ "a": "some other name" }
|
||||
{ "a": "xyz_789" }
|
||||
a=abc_123
|
||||
a=some other name
|
||||
a=xyz_789
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2004,9 +2004,9 @@ $ mlr cat data/put-gating-example-2.dkvp
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$a =~ "([a-z]+)_([0-9]+)" { $b = "left_\1"; $c = "right_\2" }' data/put-gating-example-2.dkvp
|
||||
{ "a": "abc_123", "b": "left_abc", "c": "right_123" }
|
||||
{ "a": "some other name" }
|
||||
{ "a": "xyz_789", "b": "left_xyz", "c": "right_789" }
|
||||
a=abc_123,b=left_abc,c=right_123
|
||||
a=some other name
|
||||
a=xyz_789,b=left_xyz,c=right_789
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2024,11 +2024,11 @@ subsequent assignments are done unconditionally:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$x > 0.0; $y = log10($x); $z = sqrt($y)' data/put-gating-example-1.dkvp
|
||||
{ "x": -1, "y": nan, "z": nan }
|
||||
{ "x": 0, "y": -inf, "z": nan }
|
||||
{ "x": 1, "y": 0.000000, "z": 0.000000 }
|
||||
{ "x": 2, "y": 0.301030, "z": 0.548662 }
|
||||
{ "x": 3, "y": 0.477121, "z": 0.690740 }
|
||||
x=-1,y=nan,z=nan
|
||||
x=0,y=-inf,z=nan
|
||||
x=1,y=0.000000,z=0.000000
|
||||
x=2,y=0.301030,z=0.548662
|
||||
x=3,y=0.477121,z=0.690740
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2036,9 +2036,9 @@ $ mlr put '$x > 0.0; $y = log10($x); $z = sqrt($y)' data/put-gating-example-1
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$a =~ "([a-z]+)_([0-9]+)"; $b = "left_\1"; $c = "right_\2"' data/put-gating-example-2.dkvp
|
||||
{ "a": "abc_123", "b": "left_abc", "c": "right_123" }
|
||||
{ "a": "some other name", "b": "left_", "c": "right_" }
|
||||
{ "a": "xyz_789", "b": "left_xyz", "c": "right_789" }
|
||||
a=abc_123,b=left_abc,c=right_123
|
||||
a=some other name,b=left_,c=right_
|
||||
a=xyz_789,b=left_xyz,c=right_789
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2099,7 +2099,7 @@ $ echo x=1,y=2 | mlr put '
|
|||
}
|
||||
$foo = "bar"
|
||||
'
|
||||
{ "x": 1, "y": 2, "3": "", "4": "", "5": "", "6": "", "7": "", "8": "", "9": "", "10": "", "foo": "bar" }
|
||||
x=1,y=2,3=,4=,5=,6=,7=,8=,9=,10=,foo=bar
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2115,7 +2115,7 @@ $ echo x=1,y=2 | mlr put '
|
|||
} while (NF < 10);
|
||||
$foo = "bar"
|
||||
'
|
||||
{ "x": 1, "y": 2, "3": "", "4": "", "5": "", "foo": "bar" }
|
||||
x=1,y=2,3=,4=,5=,foo=bar
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2171,35 +2171,35 @@ NR = 1
|
|||
key:i value:1
|
||||
key:x value:0.346790
|
||||
key:y value:0.726803
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
NR = 2
|
||||
key:a value:eks
|
||||
key:b value:pan
|
||||
key:i value:2
|
||||
key:x value:0.758680
|
||||
key:y value:0.522151
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
NR = 3
|
||||
key:a value:wye
|
||||
key:b value:wye
|
||||
key:i value:3
|
||||
key:x value:0.204603
|
||||
key:y value:0.338319
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
NR = 4
|
||||
key:a value:eks
|
||||
key:b value:wye
|
||||
key:i value:4
|
||||
key:x value:0.381399
|
||||
key:y value:0.134189
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
NR = 5
|
||||
key:a value:wye
|
||||
key:b value:pan
|
||||
key:i value:5
|
||||
key:x value:0.573289
|
||||
key:y value:0.863624
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2570,17 +2570,17 @@ $ mlr put '
|
|||
@x_sum += $x;
|
||||
end { emit @x_sum }
|
||||
' ../data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
{ "a": "zee", "b": "pan", "i": 6, "x": 0.5271261600918548, "y": 0.49322128674835697 }
|
||||
{ "a": "eks", "b": "zee", "i": 7, "x": 0.6117840605678454, "y": 0.1878849191181694 }
|
||||
{ "a": "zee", "b": "wye", "i": 8, "x": 0.5985540091064224, "y": 0.976181385699006 }
|
||||
{ "a": "hat", "b": "wye", "i": 9, "x": 0.03144187646093577, "y": 0.7495507603507059 }
|
||||
{ "a": "pan", "b": "wye", "i": 10, "x": 0.5026260055412137, "y": 0.9526183602969864 }
|
||||
{ "x_sum": 4.536294 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
|
||||
a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694
|
||||
a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006
|
||||
a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059
|
||||
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
|
||||
x_sum=4.536294
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2597,17 +2597,17 @@ $ mlr put '
|
|||
@x_sum += $x;
|
||||
end { emit @x_sum }
|
||||
' ../data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "y": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
{ "a": "zee", "b": "pan", "i": 6, "x": 0.5271261600918548, "y": 0.49322128674835697 }
|
||||
{ "a": "eks", "b": "zee", "i": 7, "x": 0.6117840605678454, "y": 0.1878849191181694 }
|
||||
{ "a": "zee", "b": "wye", "i": 8, "x": 0.5985540091064224, "y": 0.976181385699006 }
|
||||
{ "a": "hat", "b": "wye", "i": 9, "x": 0.03144187646093577, "y": 0.7495507603507059 }
|
||||
{ "a": "pan", "b": "wye", "i": 10, "x": 0.5026260055412137, "y": 0.9526183602969864 }
|
||||
{ "x_sum": 4.536294 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,y=0.7268028627434533
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
a=zee,b=pan,i=6,x=0.5271261600918548,y=0.49322128674835697
|
||||
a=eks,b=zee,i=7,x=0.6117840605678454,y=0.1878849191181694
|
||||
a=zee,b=wye,i=8,x=0.5985540091064224,y=0.976181385699006
|
||||
a=hat,b=wye,i=9,x=0.03144187646093577,y=0.7495507603507059
|
||||
a=pan,b=wye,i=10,x=0.5026260055412137,y=0.9526183602969864
|
||||
x_sum=4.536294
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2623,7 +2623,7 @@ $ mlr put -q '
|
|||
@x_sum += $x;
|
||||
end { emit @x_sum }
|
||||
' ../data/small
|
||||
{ "x_sum": 4.536294 }
|
||||
x_sum=4.536294
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2641,8 +2641,8 @@ $ mlr put -q '
|
|||
emit @x_sum;
|
||||
}
|
||||
' ../data/small
|
||||
{ "x_count": 10 }
|
||||
{ "x_sum": 4.536294 }
|
||||
x_count=10
|
||||
x_sum=4.536294
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2653,7 +2653,7 @@ This is of course not much different than
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr stats1 -a count,sum -f x ../data/small
|
||||
{ "x_count": 10, "x_sum": 4.536294 }
|
||||
x_count=10,x_sum=4.536294
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3011,7 +3011,7 @@ For <code>emitf</code> these mustn’t have indexing using <code>@name[...]<
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@count += 1; @x_sum += $x; @y_sum += $y; end { emitf @count, @x_sum, @y_sum}' data/small
|
||||
{ "count": 5, "x_sum": 2.264762, "y_sum": 2.585086 }
|
||||
count=5,x_sum=2.264762,y_sum=2.585086
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3044,7 +3044,7 @@ $ mlr put -q '@sum += $x; end { dump }' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@sum += $x; end { emit @sum }' data/small
|
||||
{ "sum": 2.264762 }
|
||||
sum=2.264762
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3069,9 +3069,9 @@ $ mlr put -q '@sum[$a] += $x; end { dump }' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@sum[$a] += $x; end { emit @sum, "a" }' data/small
|
||||
{ "a": "pan", "sum": 0.346790 }
|
||||
{ "a": "eks", "sum": 1.140079 }
|
||||
{ "a": "wye", "sum": 0.777892 }
|
||||
a=pan,sum=0.346790
|
||||
a=eks,sum=1.140079
|
||||
a=wye,sum=0.777892
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3102,11 +3102,11 @@ $ mlr put -q '@sum[$a][$b] += $x; end { dump }' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@sum[$a][$b] += $x; end { emit @sum, "a", "b" }' data/small
|
||||
{ "a": "pan", "b": "pan", "sum": 0.346790 }
|
||||
{ "a": "eks", "b": "pan", "sum": 0.758680 }
|
||||
{ "a": "eks", "b": "wye", "sum": 0.381399 }
|
||||
{ "a": "wye", "b": "wye", "sum": 0.204603 }
|
||||
{ "a": "wye", "b": "pan", "sum": 0.573289 }
|
||||
a=pan,b=pan,sum=0.346790
|
||||
a=eks,b=pan,sum=0.758680
|
||||
a=eks,b=wye,sum=0.381399
|
||||
a=wye,b=wye,sum=0.204603
|
||||
a=wye,b=pan,sum=0.573289
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3147,11 +3147,11 @@ $ mlr put -q '@sum[$a][$b][$i] += $x; end { dump }' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@sum[$a][$b][$i] += $x; end { emit @sum, "a", "b", "i" }' data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "sum": 0.346790 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "sum": 0.758680 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "sum": 0.381399 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "sum": 0.204603 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "sum": 0.573289 }
|
||||
a=pan,b=pan,i=1,sum=0.346790
|
||||
a=eks,b=pan,i=2,sum=0.758680
|
||||
a=eks,b=wye,i=4,sum=0.381399
|
||||
a=wye,b=wye,i=3,sum=0.204603
|
||||
a=wye,b=pan,i=5,sum=0.573289
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3189,9 +3189,9 @@ $ mlr put -q '@sum[$a][$b] += $x; end { dump }' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@sum[$a][$b] += $x; end { emit @sum, "a" }' data/small
|
||||
{ "a": "pan", "pan": 0.346790 }
|
||||
{ "a": "eks", "pan": 0.758680, "wye": 0.381399 }
|
||||
{ "a": "wye", "wye": 0.204603, "pan": 0.573289 }
|
||||
a=pan,pan=0.346790
|
||||
a=eks,pan=0.758680,wye=0.381399
|
||||
a=wye,wye=0.204603,pan=0.573289
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3199,9 +3199,9 @@ $ mlr put -q '@sum[$a][$b] += $x; end { emit @sum, "a" }' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@sum[$a][$b] += $x; end { emit @sum }' data/small
|
||||
{ "pan": 0.346790 }
|
||||
{ "pan": 0.758680, "wye": 0.381399 }
|
||||
{ "wye": 0.204603, "pan": 0.573289 }
|
||||
pan=0.346790
|
||||
pan=0.758680,wye=0.381399
|
||||
wye=0.204603,pan=0.573289
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3209,9 +3209,9 @@ $ mlr put -q '@sum[$a][$b] += $x; end { emit @sum }' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@sum[$a][$b] += $x; end { emitp @sum, "a" }' data/small
|
||||
{ "a": "pan", "sum": {"pan": 0.346790 } }
|
||||
{ "a": "eks", "sum": {"pan": 0.758680, "wye": 0.381399 } }
|
||||
{ "a": "wye", "sum": {"wye": 0.204603, "pan": 0.573289 } }
|
||||
a=pan,sum:pan=0.346790
|
||||
a=eks,sum:pan=0.758680,sum:wye=0.381399
|
||||
a=wye,sum:wye=0.204603,sum:pan=0.573289
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3219,7 +3219,7 @@ $ mlr put -q '@sum[$a][$b] += $x; end { emitp @sum, "a" }' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@sum[$a][$b] += $x; end { emitp @sum }' data/small
|
||||
{ "sum": {"pan": {"pan": 0.346790 },"eks": {"pan": 0.758680, "wye": 0.381399 },"wye": {"wye": 0.204603, "pan": 0.573289 } } }
|
||||
sum:pan:pan=0.346790,sum:eks:pan=0.758680,sum:eks:wye=0.381399,sum:wye:wye=0.204603,sum:wye:pan=0.573289
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3243,9 +3243,9 @@ keys for <code>emitp</code> (it defaults to a colon):
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q --oflatsep / '@sum[$a][$b] += $x; end { emitp @sum, "a" }' data/small
|
||||
{ "a": "pan", "sum/pan": 0.346790 }
|
||||
{ "a": "eks", "sum/pan": 0.758680, "sum/wye": 0.381399 }
|
||||
{ "a": "wye", "sum/wye": 0.204603, "sum/pan": 0.573289 }
|
||||
a=pan,sum/pan=0.346790
|
||||
a=eks,sum/pan=0.758680,sum/wye=0.381399
|
||||
a=wye,sum/wye=0.204603,sum/pan=0.573289
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3253,7 +3253,7 @@ $ mlr put -q --oflatsep / '@sum[$a][$b] += $x; end { emitp @sum, "a" }' data/sma
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q --oflatsep / '@sum[$a][$b] += $x; end { emitp @sum }' data/small
|
||||
{ "sum/pan/pan": 0.346790, "sum/eks/pan": 0.758680, "sum/eks/wye": 0.381399, "sum/wye/wye": 0.204603, "sum/wye/pan": 0.573289 }
|
||||
sum/pan/pan=0.346790,sum/eks/pan=0.758680,sum/eks/wye=0.381399,sum/wye/wye=0.204603,sum/wye/pan=0.573289
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3405,11 +3405,11 @@ a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put 'unset $x, $a' data/small
|
||||
{ "b": "pan", "i": 1, "y": 0.7268028627434533 }
|
||||
{ "b": "pan", "i": 2, "y": 0.5221511083334797 }
|
||||
{ "b": "wye", "i": 3, "y": 0.33831852551664776 }
|
||||
{ "b": "wye", "i": 4, "y": 0.13418874328430463 }
|
||||
{ "b": "pan", "i": 5, "y": 0.8636244699032729 }
|
||||
b=pan,i=1,y=0.7268028627434533
|
||||
b=pan,i=2,y=0.5221511083334797
|
||||
b=wye,i=3,y=0.33831852551664776
|
||||
b=wye,i=4,y=0.13418874328430463
|
||||
b=pan,i=5,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3492,8 +3492,8 @@ following two are synonymous:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr filter 'NR==2 || NR==3' data/small
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3501,8 +3501,8 @@ $ mlr filter 'NR==2 || NR==3' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put 'filter NR==2 || NR==3' data/small
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3514,9 +3514,9 @@ for the filter, and/or do other things in addition to the filter:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '@running_sum += $x; filter @running_sum > 1.3' data/small
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "y": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "y": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729 }
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,y=0.33831852551664776
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,y=0.13418874328430463
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3524,8 +3524,8 @@ $ mlr put '@running_sum += $x; filter @running_sum > 1.3' data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$z = $x * $y; filter $z > 0.3' data/small
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "y": 0.5221511083334797, "z": 0.396146 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "y": 0.8636244699032729, "z": 0.495106 }
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,y=0.5221511083334797,z=0.396146
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729,z=0.495106
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
|
|||
|
|
@ -148,9 +148,9 @@ More information about them can be found <a href="reference-dsl.html">here</a>.
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr stats1 -a sum -f x -g a data/small
|
||||
{ "a": "pan", "x_sum": 0.346790 }
|
||||
{ "a": "eks", "x_sum": 1.140079 }
|
||||
{ "a": "wye", "x_sum": 0.777892 }
|
||||
a=pan,x_sum=0.346790
|
||||
a=eks,x_sum=1.140079
|
||||
a=wye,x_sum=0.777892
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -169,9 +169,9 @@ $ mlr stats1 -a sum -f x -g a data/small
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put -q '@x_sum[$a] += $x; end{emit @x_sum, "a"}' data/small
|
||||
{ "a": "pan", "x_sum": 0.346790 }
|
||||
{ "a": "eks", "x_sum": 1.140079 }
|
||||
{ "a": "wye", "x_sum": 0.777892 }
|
||||
a=pan,x_sum=0.346790
|
||||
a=eks,x_sum=1.140079
|
||||
a=wye,x_sum=0.777892
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -207,7 +207,7 @@ Given fields with values of the form a,b,c,d,e,f emits a=b,c=d,e=f pairs.
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'a,b,c,d,e,f' | mlr altkv
|
||||
{ "a": "b", "c": "d", "e": "f" }
|
||||
a=b,c=d,e=f
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -215,7 +215,7 @@ $ echo 'a,b,c,d,e,f' | mlr altkv
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'a,b,c,d,e,f,g' | mlr altkv
|
||||
{ "a": "b", "c": "d", "e": "f", "4": "g" }
|
||||
a=b,c=d,e=f,4=g
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -612,7 +612,7 @@ Options:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr count data/medium
|
||||
{ "count": 10000 }
|
||||
count=10000
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -621,11 +621,11 @@ $ mlr count data/medium
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr count -g a data/medium
|
||||
{ "a": "pan", "count": 2081 }
|
||||
{ "a": "eks", "count": 1965 }
|
||||
{ "a": "wye", "count": 1966 }
|
||||
{ "a": "zee", "count": 2047 }
|
||||
{ "a": "hat", "count": 1941 }
|
||||
a=pan,count=2081
|
||||
a=eks,count=1965
|
||||
a=wye,count=1966
|
||||
a=zee,count=2047
|
||||
a=hat,count=1941
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -634,31 +634,31 @@ $ mlr count -g a data/medium
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr count -g a,b data/medium
|
||||
{ "a": "pan", "b": "pan", "count": 427 }
|
||||
{ "a": "eks", "b": "pan", "count": 371 }
|
||||
{ "a": "wye", "b": "wye", "count": 377 }
|
||||
{ "a": "eks", "b": "wye", "count": 407 }
|
||||
{ "a": "wye", "b": "pan", "count": 392 }
|
||||
{ "a": "zee", "b": "pan", "count": 389 }
|
||||
{ "a": "eks", "b": "zee", "count": 357 }
|
||||
{ "a": "zee", "b": "wye", "count": 455 }
|
||||
{ "a": "hat", "b": "wye", "count": 423 }
|
||||
{ "a": "pan", "b": "wye", "count": 395 }
|
||||
{ "a": "zee", "b": "eks", "count": 391 }
|
||||
{ "a": "hat", "b": "zee", "count": 385 }
|
||||
{ "a": "hat", "b": "eks", "count": 389 }
|
||||
{ "a": "wye", "b": "hat", "count": 426 }
|
||||
{ "a": "pan", "b": "eks", "count": 429 }
|
||||
{ "a": "eks", "b": "eks", "count": 413 }
|
||||
{ "a": "hat", "b": "hat", "count": 381 }
|
||||
{ "a": "hat", "b": "pan", "count": 363 }
|
||||
{ "a": "zee", "b": "zee", "count": 403 }
|
||||
{ "a": "pan", "b": "hat", "count": 417 }
|
||||
{ "a": "pan", "b": "zee", "count": 413 }
|
||||
{ "a": "zee", "b": "hat", "count": 409 }
|
||||
{ "a": "wye", "b": "zee", "count": 385 }
|
||||
{ "a": "eks", "b": "hat", "count": 417 }
|
||||
{ "a": "wye", "b": "eks", "count": 386 }
|
||||
a=pan,b=pan,count=427
|
||||
a=eks,b=pan,count=371
|
||||
a=wye,b=wye,count=377
|
||||
a=eks,b=wye,count=407
|
||||
a=wye,b=pan,count=392
|
||||
a=zee,b=pan,count=389
|
||||
a=eks,b=zee,count=357
|
||||
a=zee,b=wye,count=455
|
||||
a=hat,b=wye,count=423
|
||||
a=pan,b=wye,count=395
|
||||
a=zee,b=eks,count=391
|
||||
a=hat,b=zee,count=385
|
||||
a=hat,b=eks,count=389
|
||||
a=wye,b=hat,count=426
|
||||
a=pan,b=eks,count=429
|
||||
a=eks,b=eks,count=413
|
||||
a=hat,b=hat,count=381
|
||||
a=hat,b=pan,count=363
|
||||
a=zee,b=zee,count=403
|
||||
a=pan,b=hat,count=417
|
||||
a=pan,b=zee,count=413
|
||||
a=zee,b=hat,count=409
|
||||
a=wye,b=zee,count=385
|
||||
a=eks,b=hat,count=417
|
||||
a=wye,b=eks,count=386
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -695,31 +695,31 @@ Options:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr count-distinct -f a,b then sort -nr count data/medium
|
||||
{ "a": "zee", "b": "wye", "count": 455 }
|
||||
{ "a": "pan", "b": "eks", "count": 429 }
|
||||
{ "a": "pan", "b": "pan", "count": 427 }
|
||||
{ "a": "wye", "b": "hat", "count": 426 }
|
||||
{ "a": "hat", "b": "wye", "count": 423 }
|
||||
{ "a": "pan", "b": "hat", "count": 417 }
|
||||
{ "a": "eks", "b": "hat", "count": 417 }
|
||||
{ "a": "eks", "b": "eks", "count": 413 }
|
||||
{ "a": "pan", "b": "zee", "count": 413 }
|
||||
{ "a": "zee", "b": "hat", "count": 409 }
|
||||
{ "a": "eks", "b": "wye", "count": 407 }
|
||||
{ "a": "zee", "b": "zee", "count": 403 }
|
||||
{ "a": "pan", "b": "wye", "count": 395 }
|
||||
{ "a": "wye", "b": "pan", "count": 392 }
|
||||
{ "a": "zee", "b": "eks", "count": 391 }
|
||||
{ "a": "zee", "b": "pan", "count": 389 }
|
||||
{ "a": "hat", "b": "eks", "count": 389 }
|
||||
{ "a": "wye", "b": "eks", "count": 386 }
|
||||
{ "a": "hat", "b": "zee", "count": 385 }
|
||||
{ "a": "wye", "b": "zee", "count": 385 }
|
||||
{ "a": "hat", "b": "hat", "count": 381 }
|
||||
{ "a": "wye", "b": "wye", "count": 377 }
|
||||
{ "a": "eks", "b": "pan", "count": 371 }
|
||||
{ "a": "hat", "b": "pan", "count": 363 }
|
||||
{ "a": "eks", "b": "zee", "count": 357 }
|
||||
a=zee,b=wye,count=455
|
||||
a=pan,b=eks,count=429
|
||||
a=pan,b=pan,count=427
|
||||
a=wye,b=hat,count=426
|
||||
a=hat,b=wye,count=423
|
||||
a=pan,b=hat,count=417
|
||||
a=eks,b=hat,count=417
|
||||
a=eks,b=eks,count=413
|
||||
a=pan,b=zee,count=413
|
||||
a=zee,b=hat,count=409
|
||||
a=eks,b=wye,count=407
|
||||
a=zee,b=zee,count=403
|
||||
a=pan,b=wye,count=395
|
||||
a=wye,b=pan,count=392
|
||||
a=zee,b=eks,count=391
|
||||
a=zee,b=pan,count=389
|
||||
a=hat,b=eks,count=389
|
||||
a=wye,b=eks,count=386
|
||||
a=hat,b=zee,count=385
|
||||
a=wye,b=zee,count=385
|
||||
a=hat,b=hat,count=381
|
||||
a=wye,b=wye,count=377
|
||||
a=eks,b=pan,count=371
|
||||
a=hat,b=pan,count=363
|
||||
a=eks,b=zee,count=357
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -728,16 +728,16 @@ $ mlr count-distinct -f a,b then sort -nr count data/medium
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr count-distinct -u -f a,b data/medium
|
||||
{ "field": "a", "value": "pan", "count": 2081 }
|
||||
{ "field": "a", "value": "eks", "count": 1965 }
|
||||
{ "field": "a", "value": "wye", "count": 1966 }
|
||||
{ "field": "a", "value": "zee", "count": 2047 }
|
||||
{ "field": "a", "value": "hat", "count": 1941 }
|
||||
{ "field": "b", "value": "pan", "count": 1942 }
|
||||
{ "field": "b", "value": "wye", "count": 2057 }
|
||||
{ "field": "b", "value": "zee", "count": 1943 }
|
||||
{ "field": "b", "value": "eks", "count": 2008 }
|
||||
{ "field": "b", "value": "hat", "count": 2050 }
|
||||
field=a,value=pan,count=2081
|
||||
field=a,value=eks,count=1965
|
||||
field=a,value=wye,count=1966
|
||||
field=a,value=zee,count=2047
|
||||
field=a,value=hat,count=1941
|
||||
field=b,value=pan,count=1942
|
||||
field=b,value=wye,count=2057
|
||||
field=b,value=zee,count=1943
|
||||
field=b,value=eks,count=2008
|
||||
field=b,value=hat,count=2050
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -746,31 +746,31 @@ $ mlr count-distinct -u -f a,b data/medium
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr count-distinct -f a,b -o someothername then sort -nr someothername data/medium
|
||||
{ "a": "zee", "b": "wye", "someothername": 455 }
|
||||
{ "a": "pan", "b": "eks", "someothername": 429 }
|
||||
{ "a": "pan", "b": "pan", "someothername": 427 }
|
||||
{ "a": "wye", "b": "hat", "someothername": 426 }
|
||||
{ "a": "hat", "b": "wye", "someothername": 423 }
|
||||
{ "a": "pan", "b": "hat", "someothername": 417 }
|
||||
{ "a": "eks", "b": "hat", "someothername": 417 }
|
||||
{ "a": "eks", "b": "eks", "someothername": 413 }
|
||||
{ "a": "pan", "b": "zee", "someothername": 413 }
|
||||
{ "a": "zee", "b": "hat", "someothername": 409 }
|
||||
{ "a": "eks", "b": "wye", "someothername": 407 }
|
||||
{ "a": "zee", "b": "zee", "someothername": 403 }
|
||||
{ "a": "pan", "b": "wye", "someothername": 395 }
|
||||
{ "a": "wye", "b": "pan", "someothername": 392 }
|
||||
{ "a": "zee", "b": "eks", "someothername": 391 }
|
||||
{ "a": "zee", "b": "pan", "someothername": 389 }
|
||||
{ "a": "hat", "b": "eks", "someothername": 389 }
|
||||
{ "a": "wye", "b": "eks", "someothername": 386 }
|
||||
{ "a": "hat", "b": "zee", "someothername": 385 }
|
||||
{ "a": "wye", "b": "zee", "someothername": 385 }
|
||||
{ "a": "hat", "b": "hat", "someothername": 381 }
|
||||
{ "a": "wye", "b": "wye", "someothername": 377 }
|
||||
{ "a": "eks", "b": "pan", "someothername": 371 }
|
||||
{ "a": "hat", "b": "pan", "someothername": 363 }
|
||||
{ "a": "eks", "b": "zee", "someothername": 357 }
|
||||
a=zee,b=wye,someothername=455
|
||||
a=pan,b=eks,someothername=429
|
||||
a=pan,b=pan,someothername=427
|
||||
a=wye,b=hat,someothername=426
|
||||
a=hat,b=wye,someothername=423
|
||||
a=pan,b=hat,someothername=417
|
||||
a=eks,b=hat,someothername=417
|
||||
a=eks,b=eks,someothername=413
|
||||
a=pan,b=zee,someothername=413
|
||||
a=zee,b=hat,someothername=409
|
||||
a=eks,b=wye,someothername=407
|
||||
a=zee,b=zee,someothername=403
|
||||
a=pan,b=wye,someothername=395
|
||||
a=wye,b=pan,someothername=392
|
||||
a=zee,b=eks,someothername=391
|
||||
a=zee,b=pan,someothername=389
|
||||
a=hat,b=eks,someothername=389
|
||||
a=wye,b=eks,someothername=386
|
||||
a=hat,b=zee,someothername=385
|
||||
a=wye,b=zee,someothername=385
|
||||
a=hat,b=hat,someothername=381
|
||||
a=wye,b=wye,someothername=377
|
||||
a=eks,b=pan,someothername=371
|
||||
a=hat,b=pan,someothername=363
|
||||
a=eks,b=zee,someothername=357
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -779,7 +779,7 @@ $ mlr count-distinct -f a,b -o someothername then sort -nr someothername data/me
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr count-distinct -n -f a,b data/medium
|
||||
{ "count": 25 }
|
||||
count=25
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -954,7 +954,7 @@ i x y
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'a=1,b=2,c=3' | mlr cut -f b,c,a
|
||||
{ "a": 1, "b": 2, "c": 3 }
|
||||
a=1,b=2,c=3
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -963,7 +963,7 @@ $ echo 'a=1,b=2,c=3' | mlr cut -f b,c,a
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'a=1,b=2,c=3' | mlr cut -o -f b,c,a
|
||||
{ "b": 2, "c": 3, "a": 1 }
|
||||
b=2,c=3,a=1
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1560,11 +1560,11 @@ preparation for CSV or pretty-print output.
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cat data/het.dkvp
|
||||
{ "resource": "/path/to/file", "loadsec": 0.45, "ok": true }
|
||||
{ "record_count": 100, "resource": "/path/to/file" }
|
||||
{ "resource": "/path/to/second/file", "loadsec": 0.32, "ok": true }
|
||||
{ "record_count": 150, "resource": "/path/to/second/file" }
|
||||
{ "resource": "/some/other/path", "loadsec": 0.97, "ok": false }
|
||||
resource=/path/to/file,loadsec=0.45,ok=true
|
||||
record_count=100,resource=/path/to/file
|
||||
resource=/path/to/second/file,loadsec=0.32,ok=true
|
||||
record_count=150,resource=/path/to/second/file
|
||||
resource=/some/other/path,loadsec=0.97,ok=false
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1621,11 +1621,11 @@ Examples:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cat data/het.dkvp
|
||||
{ "resource": "/path/to/file", "loadsec": 0.45, "ok": true }
|
||||
{ "record_count": 100, "resource": "/path/to/file" }
|
||||
{ "resource": "/path/to/second/file", "loadsec": 0.32, "ok": true }
|
||||
{ "record_count": 150, "resource": "/path/to/second/file" }
|
||||
{ "resource": "/some/other/path", "loadsec": 0.97, "ok": false }
|
||||
resource=/path/to/file,loadsec=0.45,ok=true
|
||||
record_count=100,resource=/path/to/file
|
||||
resource=/path/to/second/file,loadsec=0.32,ok=true
|
||||
record_count=150,resource=/path/to/second/file
|
||||
resource=/some/other/path,loadsec=0.97,ok=false
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1634,11 +1634,11 @@ $ mlr cat data/het.dkvp
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr having-fields --at-least resource data/het.dkvp
|
||||
{ "resource": "/path/to/file", "loadsec": 0.45, "ok": true }
|
||||
{ "record_count": 100, "resource": "/path/to/file" }
|
||||
{ "resource": "/path/to/second/file", "loadsec": 0.32, "ok": true }
|
||||
{ "record_count": 150, "resource": "/path/to/second/file" }
|
||||
{ "resource": "/some/other/path", "loadsec": 0.97, "ok": false }
|
||||
resource=/path/to/file,loadsec=0.45,ok=true
|
||||
record_count=100,resource=/path/to/file
|
||||
resource=/path/to/second/file,loadsec=0.32,ok=true
|
||||
record_count=150,resource=/path/to/second/file
|
||||
resource=/some/other/path,loadsec=0.97,ok=false
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1647,9 +1647,9 @@ $ mlr having-fields --at-least resource data/het.dkvp
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr having-fields --which-are resource,ok,loadsec data/het.dkvp
|
||||
{ "resource": "/path/to/file", "loadsec": 0.45, "ok": true }
|
||||
{ "resource": "/path/to/second/file", "loadsec": 0.32, "ok": true }
|
||||
{ "resource": "/some/other/path", "loadsec": 0.97, "ok": false }
|
||||
resource=/path/to/file,loadsec=0.45,ok=true
|
||||
resource=/path/to/second/file,loadsec=0.32,ok=true
|
||||
resource=/some/other/path,loadsec=0.97,ok=false
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2697,11 +2697,11 @@ a=wCOLUMN5e,b=pan,i=5,x=0.5732889198020006,COLUMN5=0.8636244699032729
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr rename y,COLUMN5 data/small
|
||||
{ "a": "pan", "b": "pan", "i": 1, "x": 0.3467901443380824, "COLUMN5": 0.7268028627434533 }
|
||||
{ "a": "eks", "b": "pan", "i": 2, "x": 0.7586799647899636, "COLUMN5": 0.5221511083334797 }
|
||||
{ "a": "wye", "b": "wye", "i": 3, "x": 0.20460330576630303, "COLUMN5": 0.33831852551664776 }
|
||||
{ "a": "eks", "b": "wye", "i": 4, "x": 0.38139939387114097, "COLUMN5": 0.13418874328430463 }
|
||||
{ "a": "wye", "b": "pan", "i": 5, "x": 0.5732889198020006, "COLUMN5": 0.8636244699032729 }
|
||||
a=pan,b=pan,i=1,x=0.3467901443380824,COLUMN5=0.7268028627434533
|
||||
a=eks,b=pan,i=2,x=0.7586799647899636,COLUMN5=0.5221511083334797
|
||||
a=wye,b=wye,i=3,x=0.20460330576630303,COLUMN5=0.33831852551664776
|
||||
a=eks,b=wye,i=4,x=0.38139939387114097,COLUMN5=0.13418874328430463
|
||||
a=wye,b=pan,i=5,x=0.5732889198020006,COLUMN5=0.8636244699032729
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -2835,18 +2835,18 @@ color=green,count=3
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr repeat -f count then cut -x -f count data/repeat-example.dat
|
||||
{ "color": "blue" }
|
||||
{ "color": "blue" }
|
||||
{ "color": "blue" }
|
||||
{ "color": "blue" }
|
||||
{ "color": "blue" }
|
||||
{ "color": "red" }
|
||||
{ "color": "red" }
|
||||
{ "color": "red" }
|
||||
{ "color": "red" }
|
||||
{ "color": "green" }
|
||||
{ "color": "green" }
|
||||
{ "color": "green" }
|
||||
color=blue
|
||||
color=blue
|
||||
color=blue
|
||||
color=blue
|
||||
color=blue
|
||||
color=red
|
||||
color=red
|
||||
color=red
|
||||
color=red
|
||||
color=green
|
||||
color=green
|
||||
color=green
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3076,16 +3076,16 @@ unless start == stop.
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr seqgen --stop 10
|
||||
{ "i": 1 }
|
||||
{ "i": 2 }
|
||||
{ "i": 3 }
|
||||
{ "i": 4 }
|
||||
{ "i": 5 }
|
||||
{ "i": 6 }
|
||||
{ "i": 7 }
|
||||
{ "i": 8 }
|
||||
{ "i": 9 }
|
||||
{ "i": 10 }
|
||||
i=1
|
||||
i=2
|
||||
i=3
|
||||
i=4
|
||||
i=5
|
||||
i=6
|
||||
i=7
|
||||
i=8
|
||||
i=9
|
||||
i=10
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3093,12 +3093,12 @@ $ mlr seqgen --stop 10
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr seqgen --start 20 --stop 40 --step 4
|
||||
{ "i": 20 }
|
||||
{ "i": 24 }
|
||||
{ "i": 28 }
|
||||
{ "i": 32 }
|
||||
{ "i": 36 }
|
||||
{ "i": 40 }
|
||||
i=20
|
||||
i=24
|
||||
i=28
|
||||
i=32
|
||||
i=36
|
||||
i=40
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3106,12 +3106,12 @@ $ mlr seqgen --start 20 --stop 40 --step 4
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr seqgen --start 40 --stop 20 --step -4
|
||||
{ "i": 40 }
|
||||
{ "i": 36 }
|
||||
{ "i": 32 }
|
||||
{ "i": 28 }
|
||||
{ "i": 24 }
|
||||
{ "i": 20 }
|
||||
i=40
|
||||
i=36
|
||||
i=32
|
||||
i=28
|
||||
i=24
|
||||
i=20
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3283,10 +3283,10 @@ were encountered, regardless of the specified sort order:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr sort -n x data/sort-missing.dkvp
|
||||
{ "x": 1 }
|
||||
{ "x": 2 }
|
||||
{ "x": 4 }
|
||||
{ "a": 3 }
|
||||
x=1
|
||||
x=2
|
||||
x=4
|
||||
a=3
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -3294,10 +3294,10 @@ $ mlr sort -n x data/sort-missing.dkvp
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr sort -nr x data/sort-missing.dkvp
|
||||
{ "x": 4 }
|
||||
{ "x": 2 }
|
||||
{ "x": 1 }
|
||||
{ "a": 3 }
|
||||
x=4
|
||||
x=2
|
||||
x=1
|
||||
a=3
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -4056,24 +4056,24 @@ $ wc -l data/colored-shapes.dkvp
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr uniq -g color,shape data/colored-shapes.dkvp
|
||||
{ "color": "yellow", "shape": "triangle" }
|
||||
{ "color": "red", "shape": "square" }
|
||||
{ "color": "red", "shape": "circle" }
|
||||
{ "color": "purple", "shape": "triangle" }
|
||||
{ "color": "yellow", "shape": "circle" }
|
||||
{ "color": "purple", "shape": "square" }
|
||||
{ "color": "yellow", "shape": "square" }
|
||||
{ "color": "red", "shape": "triangle" }
|
||||
{ "color": "green", "shape": "triangle" }
|
||||
{ "color": "green", "shape": "square" }
|
||||
{ "color": "blue", "shape": "circle" }
|
||||
{ "color": "blue", "shape": "triangle" }
|
||||
{ "color": "purple", "shape": "circle" }
|
||||
{ "color": "blue", "shape": "square" }
|
||||
{ "color": "green", "shape": "circle" }
|
||||
{ "color": "orange", "shape": "triangle" }
|
||||
{ "color": "orange", "shape": "square" }
|
||||
{ "color": "orange", "shape": "circle" }
|
||||
color=yellow,shape=triangle
|
||||
color=red,shape=square
|
||||
color=red,shape=circle
|
||||
color=purple,shape=triangle
|
||||
color=yellow,shape=circle
|
||||
color=purple,shape=square
|
||||
color=yellow,shape=square
|
||||
color=red,shape=triangle
|
||||
color=green,shape=triangle
|
||||
color=green,shape=square
|
||||
color=blue,shape=circle
|
||||
color=blue,shape=triangle
|
||||
color=purple,shape=circle
|
||||
color=blue,shape=square
|
||||
color=green,shape=circle
|
||||
color=orange,shape=triangle
|
||||
color=orange,shape=square
|
||||
color=orange,shape=circle
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ something else, particularly CSV. I use Miller’s pretty-print format
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'x=3.1,y=4.3' | mlr put '$z=fmtnum($x*$y,"%08lf")'
|
||||
{ "x": 3.1, "y": 4.3, "z": 13.330000 }
|
||||
x=3.1,y=4.3,z=13.330000
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -406,7 +406,7 @@ $ echo 'x=3.1,y=4.3' | mlr put '$z=fmtnum($x*$y,"%08lf")'
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'x=0xffff,y=0xff' | mlr put '$z=fmtnum(int($x*$y),"%08llx")'
|
||||
{ "x": 0xffff, "y": 0xff, "z": "00feff01" }
|
||||
x=0xffff,y=0xff,z=00feff01
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -421,7 +421,7 @@ Example:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'x=0xffff,y=0xff' | mlr put '$z=hexfmt($x*$y)'
|
||||
{ "x": 0xffff, "y": 0xff, "z": 0xfeff01 }
|
||||
x=0xffff,y=0xff,z=0xfeff01
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -761,11 +761,11 @@ all sort-field values present:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cat data/sort-null.dat
|
||||
{ "a": 3, "b": 2 }
|
||||
{ "a": 1, "b": 8 }
|
||||
{ "a": "", "b": 4 }
|
||||
{ "x": 9, "b": 10 }
|
||||
{ "a": 5, "b": 7 }
|
||||
a=3,b=2
|
||||
a=1,b=8
|
||||
a=,b=4
|
||||
x=9,b=10
|
||||
a=5,b=7
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -773,11 +773,11 @@ $ mlr cat data/sort-null.dat
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr sort -n a data/sort-null.dat
|
||||
{ "a": 1, "b": 8 }
|
||||
{ "a": 3, "b": 2 }
|
||||
{ "a": 5, "b": 7 }
|
||||
{ "a": "", "b": 4 }
|
||||
{ "x": 9, "b": 10 }
|
||||
a=1,b=8
|
||||
a=3,b=2
|
||||
a=5,b=7
|
||||
a=,b=4
|
||||
x=9,b=10
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -785,11 +785,11 @@ $ mlr sort -n a data/sort-null.dat
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr sort -nr a data/sort-null.dat
|
||||
{ "a": "", "b": 4 }
|
||||
{ "a": 5, "b": 7 }
|
||||
{ "a": 3, "b": 2 }
|
||||
{ "a": 1, "b": 8 }
|
||||
{ "x": 9, "b": 10 }
|
||||
a=,b=4
|
||||
a=5,b=7
|
||||
a=3,b=2
|
||||
a=1,b=8
|
||||
x=9,b=10
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -799,7 +799,7 @@ $ mlr sort -nr a data/sort-null.dat
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'x=2,y=3' | mlr put '$a=$x+$y'
|
||||
{ "x": 2, "y": 3, "a": 5 }
|
||||
x=2,y=3,a=5
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -807,7 +807,7 @@ $ echo 'x=2,y=3' | mlr put '$a=$x+$y'
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'x=,y=3' | mlr put '$a=$x+$y'
|
||||
{ "x": "", "y": 3, "a": "" }
|
||||
x=,y=3,a=
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -815,7 +815,7 @@ $ echo 'x=,y=3' | mlr put '$a=$x+$y'
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'x=,y=3' | mlr put '$a=log($x);$b=log($y)'
|
||||
{ "x": "", "y": 3, "a": "", "b": 1.098612 }
|
||||
x=,y=3,a=,b=1.098612
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -826,7 +826,7 @@ special: if one argument is non-null, it wins:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'x=,y=3' | mlr put '$a=min($x,$y);$b=max($x,$y)'
|
||||
{ "x": "", "y": 3, "a": 3, "b": 3 }
|
||||
x=,y=3,a=3,b=3
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -843,7 +843,7 @@ absent is not stored in the left-hand side of an assignment statement </b>:
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'x=2,y=3' | mlr put '$a=$u+$v; $b=$u+$y; $c=$x+$y'
|
||||
{ "x": 2, "y": 3, "b": 3, "c": 5 }
|
||||
x=2,y=3,b=3,c=5
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -851,7 +851,7 @@ $ echo 'x=2,y=3' | mlr put '$a=$u+$v; $b=$u+$y; $c=$x+$y'
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ echo 'x=2,y=3' | mlr put '$a=min($x,$v);$b=max($u,$y);$c=min($u,$v)'
|
||||
{ "x": 2, "y": 3, "a": 2, "b": 3 }
|
||||
x=2,y=3,a=2,b=3
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -906,11 +906,11 @@ inputs present — you can use a pattern-action block with
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr cat data/het.dkvp
|
||||
{ "resource": "/path/to/file", "loadsec": 0.45, "ok": true }
|
||||
{ "record_count": 100, "resource": "/path/to/file" }
|
||||
{ "resource": "/path/to/second/file", "loadsec": 0.32, "ok": true }
|
||||
{ "record_count": 150, "resource": "/path/to/second/file" }
|
||||
{ "resource": "/some/other/path", "loadsec": 0.97, "ok": false }
|
||||
resource=/path/to/file,loadsec=0.45,ok=true
|
||||
record_count=100,resource=/path/to/file
|
||||
resource=/path/to/second/file,loadsec=0.32,ok=true
|
||||
record_count=150,resource=/path/to/second/file
|
||||
resource=/some/other/path,loadsec=0.97,ok=false
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -918,11 +918,11 @@ $ mlr cat data/het.dkvp
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put 'is_present($loadsec) { $loadmillis = $loadsec * 1000 }' data/het.dkvp
|
||||
{ "resource": "/path/to/file", "loadsec": 0.45, "ok": true, "loadmillis": 450.000000 }
|
||||
{ "record_count": 100, "resource": "/path/to/file" }
|
||||
{ "resource": "/path/to/second/file", "loadsec": 0.32, "ok": true, "loadmillis": 320.000000 }
|
||||
{ "record_count": 150, "resource": "/path/to/second/file" }
|
||||
{ "resource": "/some/other/path", "loadsec": 0.97, "ok": false, "loadmillis": 970.000000 }
|
||||
resource=/path/to/file,loadsec=0.45,ok=true,loadmillis=450.000000
|
||||
record_count=100,resource=/path/to/file
|
||||
resource=/path/to/second/file,loadsec=0.32,ok=true,loadmillis=320.000000
|
||||
record_count=150,resource=/path/to/second/file
|
||||
resource=/some/other/path,loadsec=0.97,ok=false,loadmillis=970.000000
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -930,11 +930,11 @@ $ mlr put 'is_present($loadsec) { $loadmillis = $loadsec * 1000 }' data/het.dkvp
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr put '$loadmillis = (is_present($loadsec) ? $loadsec : 0.0) * 1000' data/het.dkvp
|
||||
{ "resource": "/path/to/file", "loadsec": 0.45, "ok": true, "loadmillis": 450.000000 }
|
||||
{ "record_count": 100, "resource": "/path/to/file", "loadmillis": 0.000000 }
|
||||
{ "resource": "/path/to/second/file", "loadsec": 0.32, "ok": true, "loadmillis": 320.000000 }
|
||||
{ "record_count": 150, "resource": "/path/to/second/file", "loadmillis": 0.000000 }
|
||||
{ "resource": "/some/other/path", "loadsec": 0.97, "ok": false, "loadmillis": 970.000000 }
|
||||
resource=/path/to/file,loadsec=0.45,ok=true,loadmillis=450.000000
|
||||
record_count=100,resource=/path/to/file,loadmillis=0.000000
|
||||
resource=/path/to/second/file,loadsec=0.32,ok=true,loadmillis=320.000000
|
||||
record_count=150,resource=/path/to/second/file,loadmillis=0.000000
|
||||
resource=/some/other/path,loadsec=0.97,ok=false,loadmillis=970.000000
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
@ -1063,8 +1063,8 @@ name=bull,regex=^b[ou]ll$
|
|||
<div class="pokipanel">
|
||||
<pre>
|
||||
$ mlr filter '$name =~ $regex' data/regex-in-data.dat
|
||||
{ "name": "jane", "regex": "^j.*e$" }
|
||||
{ "name": "bull", "regex": "^b[ou]ll$" }
|
||||
name=jane,regex=^j.*e$
|
||||
name=bull,regex=^b[ou]ll$
|
||||
</pre>
|
||||
</div>
|
||||
<p/>
|
||||
|
|
|
|||
17
doc/sample_mlrrc
Normal file
17
doc/sample_mlrrc
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
# These are my preferred default settings for Miller
|
||||
|
||||
# Input and output formats are CSV by default (unless otherwise specified
|
||||
# on the mlr command line):
|
||||
csv
|
||||
|
||||
# If a data line has fewer fields than the header line, instead of erroring
|
||||
# (which is the default), just insert empty values for the missing ones:
|
||||
allow-ragged-csv-input
|
||||
|
||||
# These are no-ops for CSV, but when I do use JSON output, I want these
|
||||
# pretty-printing options to be used:
|
||||
jvstack
|
||||
jlistwrap
|
||||
|
||||
# Use "@", rather than "#", for comments within data files:
|
||||
skip-comments-with @
|
||||
Loading…
Add table
Add a link
Reference in a new issue