From c34da576dc8a15865dff52ec852b1b2bd0cdc8e2 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Fri, 9 Oct 2015 15:12:35 -0400 Subject: [PATCH] doc neatens --- c/todo.txt | 8 ++++++-- doc/content-for-faq.html | 27 ++++++++++++++------------- doc/data/then-example.csv | 6 ++++++ doc/faq.html | 13 +++++++------ 4 files changed, 33 insertions(+), 21 deletions(-) create mode 100644 doc/data/then-example.csv diff --git a/c/todo.txt b/c/todo.txt index 5cf47022b..12266e62a 100644 --- a/c/todo.txt +++ b/c/todo.txt @@ -3,11 +3,15 @@ BUGFIXES :D ----------------------------------------------------------------- - ================================================================ TOP OF LIST +---------------------------------------------------------------- +FLIGHT: + +* +/- of then-chaining +* POSIX.2 REs + ---------------------------------------------------------------- MAJOR: regex diff --git a/doc/content-for-faq.html b/doc/content-for-faq.html index b6705ab96..7dd81b134 100644 --- a/doc/content-for-faq.html +++ b/doc/content-for-faq.html @@ -8,7 +8,7 @@ is CR/LF (carriage return followed by linefeed, following RFC4180). Yet if your CSV has *nix-standard LF line endings, Miller will keep reading the file looking for a CR/LF which never appears. Solution in this case: tell Miller the input has LF line-terminator, e.g. mlr --csv --rs -lf .... +lf {remaining arguments ...}.

Fields not selected

@@ -17,7 +17,7 @@ lf .... separator is comma; if your data is tab-delimited, e.g. aTABbTABc, then Miller won’t find three fields named a, b, and c but rather just one named aTABbTABc. Solution in this -case: mlr --fs tab .... +case: mlr --fs tab {remaining arguments ...}.

Error-output in certain string cases

@@ -35,28 +35,29 @@ POKI_CARDIFY(2015-10-08 08:29:09,445 INFO com.company.path.to.ClassName @ [somet I prefer to pre-filter with grep and/or sed to extract the structured text, then hand that to Miller. Example: -POKI_CARDIFY(grep 'various sorts' *.log | sed 's/.*} //' | mlr --fs space --repifs stats1 -a min,p10,p50,p90,max -f time -g status)HERE +POKI_CARDIFY(grep 'various sorts' *.log | sed 's/.*} //' | mlr --fs space --repifs --oxtab stats1 -a min,p10,p50,p90,max -f time -g status)HERE

How do I examine then-chaining?

-

Then-chaining in Miller is intended to function the same as Unix pipes. You -can print your data one pipeline step at a time, to see what intermediate +

Then-chaining found in Miller is intended to function the same as Unix +pipes. You can print your data one pipeline step at a time, to see what +intermediate output at one step becomes the input to the next step. -

First look at the input data: +

First, review the input data: -POKI_RUN_COMMAND{{cat data/then-example.txt}}HERE +POKI_RUN_COMMAND{{cat data/then-example.csv}}HERE -Then run the first step of your command, omitting anything from the first then onward: +Next, run the first step of your command, omitting anything from the first then onward: -POKI_RUN_COMMAND{{mlr --icsv --rs lf --opprint count-distinct -f Status,Payment_Type data/then-example.txt}}HERE +POKI_RUN_COMMAND{{mlr --icsv --rs lf --opprint count-distinct -f Status,Payment_Type data/then-example.csv}}HERE -Then run it with the next then step included: +After that, run it with the next then step included: -POKI_RUN_COMMAND{{mlr --icsv --rs lf --opprint count-distinct -f Status,Payment_Type then sort -nr count data/then-example.txt}}HERE +POKI_RUN_COMMAND{{mlr --icsv --rs lf --opprint count-distinct -f Status,Payment_Type then sort -nr count data/then-example.csv}}HERE -Now if you go on to include another then step after this, the columns Status, +Now if you include another then step after this, the columns Status, Payment_Type, and count will be its input.

Note, by the way, that you’ll get the same results using pipes: -POKI_RUN_COMMAND{{mlr --csv --rs lf count-distinct -f Status,Payment_Type data/then-example.txt | mlr --icsv --rs lf --opprint sort -nr count}}HERE +POKI_RUN_COMMAND{{mlr --csv --rs lf count-distinct -f Status,Payment_Type data/then-example.csv | mlr --icsv --rs lf --opprint sort -nr count}}HERE diff --git a/doc/data/then-example.csv b/doc/data/then-example.csv new file mode 100644 index 000000000..c77b32024 --- /dev/null +++ b/doc/data/then-example.csv @@ -0,0 +1,6 @@ +Status,Payment_Type,Amount +paid,cash,10.00 +pending,debit,20.00 +paid,cash,50.00 +pending,credit,40.00 +paid,debit,30.00 diff --git a/doc/faq.html b/doc/faq.html index f1908fcc0..b6cf7cd3b 100644 --- a/doc/faq.html +++ b/doc/faq.html @@ -110,7 +110,7 @@ is CR/LF (carriage return followed by linefeed, following RFC4180). Yet if your CSV has *nix-standard LF line endings, Miller will keep reading the file looking for a CR/LF which never appears. Solution in this case: tell Miller the input has LF line-terminator, e.g. mlr --csv --rs -lf .... +lf {remaining arguments ...}.

Fields not selected

@@ -119,7 +119,7 @@ lf .... separator is comma; if your data is tab-delimited, e.g. aTABbTABc, then Miller won’t find three fields named a, b, and c but rather just one named aTABbTABc. Solution in this -case: mlr --fs tab .... +case: mlr --fs tab {remaining arguments ...}.

Error-output in certain string cases

@@ -153,8 +153,9 @@ grep 'various sorts' *.log | sed 's/.*} //' | mlr --fs space --repifs stats1 -a

How do I examine then-chaining?

-

Then-chaining found in Miller is intended to function the same as Unix pipes. You -can print your data one pipeline step at a time, to see what intermediate +

Then-chaining found in Miller is intended to function the same as Unix +pipes. You can print your data one pipeline step at a time, to see what +intermediate output at one step becomes the input to the next step.

First, review the input data: @@ -204,9 +205,9 @@ paid debit 1

Now if you include another then step after this, the columns Status, -Payment_Type and count will be its input. +Payment_Type, and count will be its input. -

Note, by the way, that you will get the same results using pipes: +

Note, by the way, that you’ll get the same results using pipes: