diff --git a/c/cli/mlrcli.c b/c/cli/mlrcli.c index a6980593c..ed1389440 100644 --- a/c/cli/mlrcli.c +++ b/c/cli/mlrcli.c @@ -743,9 +743,9 @@ static void main_usage_format_conversion_keystroke_saver_options(FILE* o, char* fprintf(o, " --j2c --j2t --j2d --j2n --j2x --j2p --j2m\n"); fprintf(o, " --x2c --x2t --x2d --x2n --x2j --x2p --x2m\n"); fprintf(o, " --p2c --p2t --p2d --p2n --p2j --p2x --p2m\n"); - fprintf(o, "The letters c t d n j x p m refer to formats CSV with LF, TSV with LF, DKVP,\n"); - fprintf(o, "NIDX, JSON, XTAB, PPRINT, and markdown, respectively. Note that markdown format\n"); - fprintf(o, "is available for output only.\n"); + fprintf(o, "The letters c t d n j x p m refer to formats CSV, TSV, DKVP, NIDX, JSON, XTAB,\n"); + fprintf(o, "PPRINT, and markdown, respectively. Note that markdown format is available for\n"); + fprintf(o, "output only.\n"); } static void main_usage_compressed_data_options(FILE* o, char* argv0) { diff --git a/doc/10-min.html b/doc/10-min.html index 2787df262..8b58f5857 100644 --- a/doc/10-min.html +++ b/doc/10-min.html @@ -267,7 +267,7 @@ purple square 0 91 72.3735 8.2430
-@@ -472,9 +475,10 @@ $ mlr --icsv --ojson --jvstack --jlistwrap tail -n 2 example.csvUse then to pipe commands together. Also, the --g option for many Miller commands is for group-by: here, -head -n 1 -g shape outputs the first record for each distinct -value of the shape field. +-g option for many Miller commands is for group-by: here, head -n +1 -g shape outputs the first record for each distinct value of the +shape field. This means we’re finding the record with highest +index field for each distinct shape field:diff --git a/doc/content-for-10-min.html b/doc/content-for-10-min.html index 1353bda51..c4056d5ce 100644 --- a/doc/content-for-10-min.html +++ b/doc/content-for-10-min.html @@ -20,7 +20,7 @@ POKI_RUN_COMMAND{{mlr --csv cat example.csv}}HERE POKI_RUN_COMMAND{{mlr --icsv --opprint cat example.csv}}HERE -mlr head and mlr tail count records. The CSV + POKI_RUN_COMMAND{{mlr --icsv --opprint sort -f shape -nr index then head -n 1 -g shape example.csv}}HERE diff --git a/doc/content-for-file-formats.html b/doc/content-for-file-formats.html index 030f2ee1d..9fa0ddff2 100644 --- a/doc/content-for-file-formats.html +++ b/doc/content-for-file-formats.html @@ -56,15 +56,12 @@ of platform. CSV supports RFC-4180)-style double-quoting, including the ability to have commas and/or -CR-LF line-endings contained within an input field; CSV-lite does not. - -Default record separator for CSV is CR-LF; default record separator for -CSV-lite is LF. +LF/CRLF line-endings contained within an input field; CSV-lite does not. CSV does not allow heterogeneous data; CSV-lite does (see also here). -The CSV-lite input-reading code is more efficient than the CSV +The CSV-lite input-reading code is fractionally more efficient than the CSV input-reader. @@ -220,9 +217,9 @@ truly powerful, JSON-specific tool.mlr head and mlr tail count records rather than lines. The CSV header is included either way: POKI_RUN_COMMAND{{mlr --csv head -n 4 example.csv}}HERE @@ -55,12 +55,16 @@ POKI_RUN_COMMAND{{mlr --icsv --opprint put '$ratio = $quantity / $rate; $color_sJSON output: POKI_RUN_COMMAND{{mlr --icsv --ojson put '$ratio = $quantity/$rate; $shape = toupper($shape)' example.csv}}HERE + +JSON output with vertical-formatting flags: + POKI_RUN_COMMAND{{mlr --icsv --ojson --jvstack --jlistwrap tail -n 2 example.csv}}HEREUse then to pipe commands together. Also, the --g option for many Miller commands is for group-by: here, -head -n 1 -g shape outputs the first record for each distinct -value of the shape field. +-g option for many Miller commands is for group-by: here, head -n +1 -g shape outputs the first record for each distinct value of the +shape field. This means we’re finding the record with highest +index field for each distinct shape field:JSON non-streaming
-The JSON parser does not return until all input is parsed: in particular -this means that, unlike for other file formats, Miller does not (at present) -handle JSON files in tail -f contexts. +The JSON parser Miller uses does not return until all input is parsed: in +particular this means that, unlike for other file formats, Miller does not (at +present) handle JSON files in tail -f contexts.PPRINT: Pretty-printed tabular
@@ -302,7 +299,7 @@ POKI_RUN_COMMAND{{mlr --usage-format-conversion-keystroke-saver-options}}HERE- Default line endings (--irs and --ors) are auto + Default line endings (--irs and --ors) are 'auto' which means@@ -1149,33 +1149,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put ' ' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds i o fcount seconds_delta 1 1 1 0 -2 2 3 0.000034809 -3 3 3 0.000013113 +2 2 3 0.000039101 +3 3 3 0.000014067 4 5 3 0.000010967 5 8 3 0.000010967 6 13 3 0.000010967 -7 21 3 0.000010014 -8 34 3 0.000010014 -9 55 3 0.000010967 -10 89 3 0.000012159 -11 144 3 0.000010014 -12 233 3 0.000013828 -13 377 3 0.000011206 -14 610 3 0.000010014 -15 987 3 0.000009775 -16 1597 3 0.000010014 -17 2584 3 0.000011206 -18 4181 3 0.000009775 -19 6765 3 0.000010014 -20 10946 3 0.000010014 +7 21 3 0.000010967 +8 34 3 0.000010967 +9 55 3 0.000011206 +10 89 3 0.000011921 +11 144 3 0.000010967 +12 233 3 0.000015974 +13 377 3 0.000011921 +14 610 3 0.000011206 +15 987 3 0.000011921 +16 1597 3 0.000010967 +17 2584 3 0.000010967 +18 4181 3 0.000010967 +19 6765 3 0.000012159 +20 10946 3 0.000010967 21 17711 3 0.000010014 -22 28657 3 0.000010014 -23 46368 3 0.000012159 -24 75025 3 0.000010014 +22 28657 3 0.000010967 +23 46368 3 0.000012875 +24 75025 3 0.000012159 25 121393 3 0.000010967 -26 196418 3 0.000010014 -27 317811 3 0.000010014 -28 514229 3 0.000009775 +26 196418 3 0.000010967 +27 317811 3 0.000010967 +28 514229 3 0.000010967autodetect from the input file format , as long as the input file(s) have lines ending in either LF (also known as linefeed, '\n', 0x0a, Unix-style) or CRLF (also known as diff --git a/doc/cookbook.html b/doc/cookbook.html index f755fcd50..7565a9aaa 100644 --- a/doc/cookbook.html +++ b/doc/cookbook.html @@ -1091,33 +1091,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put ' ' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds i o fcount seconds_delta 1 1 1 0 -2 2 3 0.000030994 -3 3 5 0.000012875 +2 2 3 0.000034094 +3 3 5 0.000011921 4 5 9 0.000015020 -5 8 15 0.000020027 -6 13 25 0.000029087 -7 21 41 0.000042915 -8 34 67 0.000066996 -9 55 109 0.000104904 -10 89 177 0.000168085 -11 144 287 0.000272036 -12 233 465 0.000429869 -13 377 753 0.000686169 -14 610 1219 0.001107931 -15 987 1973 0.001784086 -16 1597 3193 0.002952814 -17 2584 5167 0.004665136 -18 4181 8361 0.007502079 -19 6765 13529 0.012058973 -20 10946 21891 0.019434929 -21 17711 35421 0.031375885 -22 28657 57313 0.049787998 -23 46368 92735 0.080844164 -24 75025 150049 0.129994869 -25 121393 242785 0.209208965 -26 196418 392835 0.344423056 -27 317811 635621 0.583369017 -28 514229 1028457 0.946258068 +5 8 15 0.000020981 +6 13 25 0.000030041 +7 21 41 0.000044107 +8 34 67 0.000068903 +9 55 109 0.000108004 +10 89 177 0.000171900 +11 144 287 0.000279188 +12 233 465 0.000441790 +13 377 753 0.000728130 +14 610 1219 0.001293898 +15 987 1973 0.001834154 +16 1597 3193 0.004330873 +17 2584 5167 0.006086111 +18 4181 8361 0.008031845 +19 6765 13529 0.012267113 +20 10946 21891 0.020168066 +21 17711 35421 0.031072855 +22 28657 57313 0.055731058 +23 46368 92735 0.080446005 +24 75025 150049 0.130995035 +25 121393 242785 0.207859993 +26 196418 392835 0.338934898 +27 317811 635621 0.546113968 +28 514229 1028457 0.924782991