miller-in-place doc

This commit is contained in:
John Kerl 2017-02-16 09:34:27 -05:00
parent c0cc52c2c5
commit e71fdbfbc7
3 changed files with 92 additions and 51 deletions

View file

@ -141,6 +141,26 @@ POKI_RUN_COMMAND{{mlr --opprint --right cat data/small}}HERE
</ul>
<!-- ================================================================ -->
<h2>In-place mode</h2>
<p/> Use the <tt>mlr -I</tt> flag to process files in-place. For example,
<tt>mlr -I --csv cut -x -f unwanted_column_name mydata/*.csv</tt> will remove
<tt>unwanted_column_name</tt> from all your <tt>*.csv</tt> files in your
<tt>mydata/</tt> subdirectory.
<p/> By default, Miller output goes to the screen (or you can redirect a file
using <tt>&gt;</tt> or to another process using <tt>|</tt>). With <tt>-I</tt>,
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.
<p/> Please see <a href="10-min.html#Choices_for_printing_to_files">here</a>
for examples.
<!-- ================================================================ -->
<h2>Compression</h2>

View file

@ -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
</pre>
</div>
<p/>
@ -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
</pre>
</div>
<p/>

View file

@ -147,6 +147,7 @@ Miller commands were run with pretty-print-tabular output format.
&bull;&nbsp;<a href="#On-line_help">On-line help</a><br/>
&bull;&nbsp;<a href="#I/O_options">I/O options</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#Formats">Formats</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#In-place_mode">In-place mode</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#Compression">Compression</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#Record/field/pair_separators">Record/field/pair separators</a><br/>
&nbsp;&nbsp;&nbsp;&nbsp;&bull;&nbsp;<a href="#Number_formatting">Number formatting</a><br/>
@ -667,6 +668,26 @@ wye pan 5 0.5732889198020006 0.8636244699032729
</ul>
<!-- ================================================================ -->
<a id="In-place_mode"/><h2>In-place mode</h2>
<p/> Use the <tt>mlr -I</tt> flag to process files in-place. For example,
<tt>mlr -I --csv cut -x -f unwanted_column_name mydata/*.csv</tt> will remove
<tt>unwanted_column_name</tt> from all your <tt>*.csv</tt> files in your
<tt>mydata/</tt> subdirectory.
<p/> By default, Miller output goes to the screen (or you can redirect a file
using <tt>&gt;</tt> or to another process using <tt>|</tt>). With <tt>-I</tt>,
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.
<p/> Please see <a href="10-min.html#Choices_for_printing_to_files">here</a>
for examples.
<!-- ================================================================ -->
<a id="Compression"/><h2>Compression</h2>