diff --git a/doc/content-for-customization.html b/doc/content-for-customization.html new file mode 100644 index 000000000..92714dfac --- /dev/null +++ b/doc/content-for-customization.html @@ -0,0 +1,95 @@ +POKI_PUT_TOC_HERE + +
+ + + +Suppose you always use CSV files. Then instead of always having to type +--csv as in
+ +POKI_CARDIFY(mlr --csv cut -x -f extra mydata.csv)HERE + +POKI_CARDIFY(mlr --csv sort -n id mydata.csv)HERE + +and so on, you can instead put the following into your $HOME/.mlrrc:
+ +POKI_CARDIFY(--csv)HERE + +Then you can just type things like
+ +POKI_CARDIFY(mlr cut -x -f extra mydata.csv)HERE + +POKI_CARDIFY(mlr sort -n id mydata.csv)HERE + +and the --csv part will automatically be understood. (If you do +want to process, say, a JSON file then mlr --json ... at the command +line will override the default from your .mlrrc.)
+ +Here is an example .mlrrc file: + +POKI_INCLUDE_ESCAPED(sample_mlrrc)HERE + +
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
Suppose you always use CSV files. Then instead of always having to type +--csv as in
+ + ++mlr --csv cut -x -f extra mydata.csv ++
+mlr --csv sort -n id mydata.csv ++
and so on, you can instead put the following into your $HOME/.mlrrc:
+ + ++--csv ++
Then you can just type things like
+ + ++mlr cut -x -f extra mydata.csv ++
+mlr sort -n id mydata.csv ++
and the --csv part will automatically be understood. (If you do +want to process, say, a JSON file then mlr --json ... at the command +line will override the default from your .mlrrc.)
+ +Here is an example .mlrrc file: + +
++# 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 @ ++
$ 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
$ 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'.
$ 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'.
$ 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
$ 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
NR=1 and NR=2 here??
$ 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
NF will
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
ENV["HOME"] or ENV["foo_".$hostname].
$ 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
$ 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
$ 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
$[[[3]]].
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
. then you can use braces, e
$ echo s=green,t=blue,a=3,b=4 | mlr put -q '@[$s."_".$t] = $a * $b; emit all'
-{ "green_blue": 12 }
+green_blue=12
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ 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
$ mlr stats1 -a count,sum -f x ../data/small
-{ "x_count": 10, "x_sum": 4.536294 }
+x_count=10,x_sum=4.536294
emitf these mustn’t have indexing using @name[...]<
$ 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
@@ -3044,7 +3044,7 @@ $ mlr put -q '@sum += $x; end { dump }' data/small
$ mlr put -q '@sum += $x; end { emit @sum }' data/small
-{ "sum": 2.264762 }
+sum=2.264762
@@ -3069,9 +3069,9 @@ $ mlr put -q '@sum[$a] += $x; end { dump }' data/small
$ 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
@@ -3102,11 +3102,11 @@ $ mlr put -q '@sum[$a][$b] += $x; end { dump }' data/small
$ 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
@@ -3147,11 +3147,11 @@ $ mlr put -q '@sum[$a][$b][$i] += $x; end { dump }' data/small
$ 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
@@ -3189,9 +3189,9 @@ $ mlr put -q '@sum[$a][$b] += $x; end { dump }' data/small
$ 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
@@ -3199,9 +3199,9 @@ $ mlr put -q '@sum[$a][$b] += $x; end { emit @sum, "a" }' data/small
$ 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
@@ -3209,9 +3209,9 @@ $ mlr put -q '@sum[$a][$b] += $x; end { emit @sum }' data/small
$ 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
@@ -3219,7 +3219,7 @@ $ mlr put -q '@sum[$a][$b] += $x; end { emitp @sum, "a" }' data/small
$ 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
@@ -3243,9 +3243,9 @@ keys for emitp (it defaults to a colon):
$ 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
@@ -3253,7 +3253,7 @@ $ mlr put -q --oflatsep / '@sum[$a][$b] += $x; end { emitp @sum, "a" }' data/sma
$ 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
@@ -3405,11 +3405,11 @@ a=wye,b=pan,i=5,x=0.5732889198020006,y=0.8636244699032729
$ 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
@@ -3492,8 +3492,8 @@ following two are synonymous:
$ 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
@@ -3501,8 +3501,8 @@ $ mlr filter 'NR==2 || NR==3' data/small
$ 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
@@ -3514,9 +3514,9 @@ for the filter, and/or do other things in addition to the filter:
$ 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
@@ -3524,8 +3524,8 @@ $ mlr put '@running_sum += $x; filter @running_sum > 1.3' data/small
$ 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
diff --git a/doc/reference-verbs.html b/doc/reference-verbs.html
index e9eed5b66..059f9309a 100644
--- a/doc/reference-verbs.html
+++ b/doc/reference-verbs.html
@@ -148,9 +148,9 @@ More information about them can be found here.
$ 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
@@ -169,9 +169,9 @@ $ mlr stats1 -a sum -f x -g a data/small
$ 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
@@ -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.
$ echo 'a,b,c,d,e,f' | mlr altkv
-{ "a": "b", "c": "d", "e": "f" }
+a=b,c=d,e=f
@@ -215,7 +215,7 @@ $ echo 'a,b,c,d,e,f' | mlr altkv
$ 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
@@ -612,7 +612,7 @@ Options:
$ mlr count data/medium
-{ "count": 10000 }
+count=10000
@@ -621,11 +621,11 @@ $ mlr count data/medium
$ 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
@@ -634,31 +634,31 @@ $ mlr count -g a data/medium
$ 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
@@ -695,31 +695,31 @@ Options:
$ 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
@@ -728,16 +728,16 @@ $ mlr count-distinct -f a,b then sort -nr count data/medium
$ 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
@@ -746,31 +746,31 @@ $ mlr count-distinct -u -f a,b data/medium
$ 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
@@ -779,7 +779,7 @@ $ mlr count-distinct -f a,b -o someothername then sort -nr someothername data/me
$ mlr count-distinct -n -f a,b data/medium
-{ "count": 25 }
+count=25
@@ -954,7 +954,7 @@ i x y
$ 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
@@ -963,7 +963,7 @@ $ echo 'a=1,b=2,c=3' | mlr cut -f b,c,a
$ 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
@@ -1560,11 +1560,11 @@ preparation for CSV or pretty-print output.
$ 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
@@ -1621,11 +1621,11 @@ Examples:
$ 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
@@ -1634,11 +1634,11 @@ $ mlr cat data/het.dkvp
$ 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
@@ -1647,9 +1647,9 @@ $ mlr having-fields --at-least resource data/het.dkvp
$ 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
@@ -2697,11 +2697,11 @@ a=wCOLUMN5e,b=pan,i=5,x=0.5732889198020006,COLUMN5=0.8636244699032729
$ 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
@@ -2835,18 +2835,18 @@ color=green,count=3
$ 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
@@ -3076,16 +3076,16 @@ unless start == stop.
$ 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
@@ -3093,12 +3093,12 @@ $ mlr seqgen --stop 10
$ 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
@@ -3106,12 +3106,12 @@ $ mlr seqgen --start 20 --stop 40 --step 4
$ 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
@@ -3283,10 +3283,10 @@ were encountered, regardless of the specified sort order:
$ mlr sort -n x data/sort-missing.dkvp
-{ "x": 1 }
-{ "x": 2 }
-{ "x": 4 }
-{ "a": 3 }
+x=1
+x=2
+x=4
+a=3
@@ -3294,10 +3294,10 @@ $ mlr sort -n x data/sort-missing.dkvp
$ mlr sort -nr x data/sort-missing.dkvp
-{ "x": 4 }
-{ "x": 2 }
-{ "x": 1 }
-{ "a": 3 }
+x=4
+x=2
+x=1
+a=3
@@ -4056,24 +4056,24 @@ $ wc -l data/colored-shapes.dkvp
$ 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
diff --git a/doc/reference.html b/doc/reference.html
index 2531ca24f..81074565f 100644
--- a/doc/reference.html
+++ b/doc/reference.html
@@ -398,7 +398,7 @@ something else, particularly CSV. I use Miller’s pretty-print format
$ 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
@@ -406,7 +406,7 @@ $ echo 'x=3.1,y=4.3' | mlr put '$z=fmtnum($x*$y,"%08lf")'
$ 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
@@ -421,7 +421,7 @@ Example:
$ echo 'x=0xffff,y=0xff' | mlr put '$z=hexfmt($x*$y)'
-{ "x": 0xffff, "y": 0xff, "z": 0xfeff01 }
+x=0xffff,y=0xff,z=0xfeff01
@@ -761,11 +761,11 @@ all sort-field values present:
$ 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
@@ -773,11 +773,11 @@ $ mlr cat data/sort-null.dat
$ 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
@@ -785,11 +785,11 @@ $ mlr sort -n a data/sort-null.dat
$ 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
@@ -799,7 +799,7 @@ $ mlr sort -nr a data/sort-null.dat
$ echo 'x=2,y=3' | mlr put '$a=$x+$y'
-{ "x": 2, "y": 3, "a": 5 }
+x=2,y=3,a=5
@@ -807,7 +807,7 @@ $ echo 'x=2,y=3' | mlr put '$a=$x+$y'
$ echo 'x=,y=3' | mlr put '$a=$x+$y'
-{ "x": "", "y": 3, "a": "" }
+x=,y=3,a=
@@ -815,7 +815,7 @@ $ echo 'x=,y=3' | mlr put '$a=$x+$y'
$ 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
@@ -826,7 +826,7 @@ special: if one argument is non-null, it wins:
$ 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
@@ -843,7 +843,7 @@ absent is not stored in the left-hand side of an assignment statement :
$ 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
@@ -851,7 +851,7 @@ $ echo 'x=2,y=3' | mlr put '$a=$u+$v; $b=$u+$y; $c=$x+$y'
$ 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
@@ -906,11 +906,11 @@ inputs present — you can use a pattern-action block with
$ 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
@@ -918,11 +918,11 @@ $ mlr cat data/het.dkvp
$ 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
@@ -930,11 +930,11 @@ $ mlr put 'is_present($loadsec) { $loadmillis = $loadsec * 1000 }' data/het.dkvp
$ 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
@@ -1063,8 +1063,8 @@ name=bull,regex=^b[ou]ll$
$ 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$
diff --git a/doc/sample_mlrrc b/doc/sample_mlrrc
new file mode 100644
index 000000000..b13d78cd6
--- /dev/null
+++ b/doc/sample_mlrrc
@@ -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 @