From e71fdbfbc733fbbbde46a23d193f06495846ef54 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Thu, 16 Feb 2017 09:34:27 -0500 Subject: [PATCH] miller-in-place doc --- doc/content-for-reference.html | 20 +++++++ doc/cookbook.html | 102 ++++++++++++++++----------------- doc/reference.html | 21 +++++++ 3 files changed, 92 insertions(+), 51 deletions(-) diff --git a/doc/content-for-reference.html b/doc/content-for-reference.html index 427b9d50a..892104aaf 100644 --- a/doc/content-for-reference.html +++ b/doc/content-for-reference.html @@ -141,6 +141,26 @@ POKI_RUN_COMMAND{{mlr --opprint --right cat data/small}}HERE + +

In-place mode

+ +

Use the mlr -I flag to process files in-place. For example, +mlr -I --csv cut -x -f unwanted_column_name mydata/*.csv will remove +unwanted_column_name from all your *.csv files in your +mydata/ subdirectory. + +

By default, Miller output goes to the screen (or you can redirect a file +using > or to another process using |). With -I, +for each file name on the command line, output is written to a temporary file +in the same directory. Miller writes its output into that temp file, which is +then renamed over the original. Then, processing continues on the next file. +Each file is processed in isolation: if the output format is CSV, CSV headers +will be present in each output file; statistics are only over each file's own +records; and so on. + +

Please see here +for examples. +

Compression

diff --git a/doc/cookbook.html b/doc/cookbook.html index 6c4a5bccd..e2140405a 100644 --- a/doc/cookbook.html +++ b/doc/cookbook.html @@ -607,33 +607,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put ' ' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds i o fcount seconds_delta 1 1 1 0 -2 2 3 0.000035048 -3 3 5 0.000012875 -4 5 9 0.000017166 -5 8 15 0.000021935 -6 13 25 0.000032902 -7 21 41 0.000048161 -8 34 67 0.000073910 -9 55 109 0.000117064 -10 89 177 0.000185966 -11 144 287 0.000303030 -12 233 465 0.000478029 -13 377 753 0.000764847 -14 610 1219 0.001672983 -15 987 1973 0.001921177 -16 1597 3193 0.003156900 -17 2584 5167 0.005409002 -18 4181 8361 0.008440018 -19 6765 13529 0.012629986 -20 10946 21891 0.020117044 -21 17711 35421 0.031926870 -22 28657 57313 0.052613020 -23 46368 92735 0.092349052 -24 75025 150049 0.142802954 -25 121393 242785 0.223661184 -26 196418 392835 0.371279955 -27 317811 635621 0.588642836 -28 514229 1028457 0.961585999 +2 2 3 0.000032902 +3 3 5 0.000013113 +4 5 9 0.000015020 +5 8 15 0.000020981 +6 13 25 0.000030041 +7 21 41 0.000043869 +8 34 67 0.000069141 +9 55 109 0.000108004 +10 89 177 0.000172853 +11 144 287 0.000279188 +12 233 465 0.000440836 +13 377 753 0.000707150 +14 610 1219 0.001134872 +15 987 1973 0.001888037 +16 1597 3193 0.002954006 +17 2584 5167 0.004790068 +18 4181 8361 0.008813858 +19 6765 13529 0.012180090 +20 10946 21891 0.019551992 +21 17711 35421 0.031635046 +22 28657 57313 0.053840876 +23 46368 92735 0.081580162 +24 75025 150049 0.138602972 +25 121393 242785 0.220221043 +26 196418 392835 0.349595785 +27 317811 635621 0.610495090 +28 514229 1028457 1.026066065

@@ -665,33 +665,33 @@ $ mlr --ofmt '%.9lf' --opprint seqgen --start 1 --stop 28 then put ' ' then put '$seconds=systime()' then step -a delta -f seconds then cut -x -f seconds i o fcount seconds_delta 1 1 1 0 -2 2 3 0.000035048 -3 3 3 0.000012875 -4 5 3 0.000010967 -5 8 3 0.000011206 -6 13 3 0.000010967 -7 21 3 0.000010014 -8 34 3 0.000010014 -9 55 3 0.000010014 +2 2 3 0.000037193 +3 3 3 0.000013828 +4 5 3 0.000012159 +5 8 3 0.000010967 +6 13 3 0.000011921 +7 21 3 0.000011921 +8 34 3 0.000011206 +9 55 3 0.000010967 10 89 3 0.000011921 -11 144 3 0.000010967 -12 233 3 0.000013113 -13 377 3 0.000010967 -14 610 3 0.000010014 -15 987 3 0.000010014 +11 144 3 0.000011921 +12 233 3 0.000015020 +13 377 3 0.000012159 +14 610 3 0.000010967 +15 987 3 0.000010967 16 1597 3 0.000010967 -17 2584 3 0.000008821 -18 4181 3 0.000010014 -19 6765 3 0.000010014 -20 10946 3 0.000010014 -21 17711 3 0.000010014 -22 28657 3 0.000010014 -23 46368 3 0.000012159 -24 75025 3 0.000009775 -25 121393 3 0.000010014 -26 196418 3 0.000010014 +17 2584 3 0.000010967 +18 4181 3 0.000010967 +19 6765 3 0.000011206 +20 10946 3 0.000010967 +21 17711 3 0.000010967 +22 28657 3 0.000010967 +23 46368 3 0.000012875 +24 75025 3 0.000011206 +25 121393 3 0.000011921 +26 196418 3 0.000010967 27 317811 3 0.000010014 -28 514229 3 0.000010014 +28 514229 3 0.000010967

diff --git a/doc/reference.html b/doc/reference.html index de50be076..cae673828 100644 --- a/doc/reference.html +++ b/doc/reference.html @@ -147,6 +147,7 @@ Miller commands were run with pretty-print-tabular output format. • On-line help
• I/O options
    • Formats
+    • In-place mode
    • Compression
    • Record/field/pair separators
    • Number formatting
@@ -667,6 +668,26 @@ wye pan 5 0.5732889198020006 0.8636244699032729 + +

In-place mode

+ +

Use the mlr -I flag to process files in-place. For example, +mlr -I --csv cut -x -f unwanted_column_name mydata/*.csv will remove +unwanted_column_name from all your *.csv files in your +mydata/ subdirectory. + +

By default, Miller output goes to the screen (or you can redirect a file +using > or to another process using |). With -I, +for each file name on the command line, output is written to a temporary file +in the same directory. Miller writes its output into that temp file, which is +then renamed over the original. Then, processing continues on the next file. +Each file is processed in isolation: if the output format is CSV, CSV headers +will be present in each output file; statistics are only over each file's own +records; and so on. + +

Please see here +for examples. +

Compression