mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 02:14:13 +00:00
--ofmte, --ofmtf, --ofmtg (#1206)
This commit is contained in:
parent
a97353a257
commit
6fc33c682a
18 changed files with 87 additions and 0 deletions
|
|
@ -557,6 +557,9 @@ MILLER(1) MILLER(1)
|
|||
floating-point numbers. If not specified, default
|
||||
formatting is used. See also the `fmtnum` function
|
||||
and the `format-values` verb.
|
||||
--ofmte {n} Use --ofmte 6 as shorthand for --ofmt %.6e, etc.
|
||||
--ofmtf {n} Use --ofmtf 6 as shorthand for --ofmt %.6f, etc.
|
||||
--ofmtg {n} Use --ofmtg 6 as shorthand for --ofmt %.6g, etc.
|
||||
--records-per-batch {n} This is an internal parameter for maximum number of
|
||||
records in a batch size. Normally this does not need
|
||||
to be modified.
|
||||
|
|
|
|||
|
|
@ -536,6 +536,9 @@ MILLER(1) MILLER(1)
|
|||
floating-point numbers. If not specified, default
|
||||
formatting is used. See also the `fmtnum` function
|
||||
and the `format-values` verb.
|
||||
--ofmte {n} Use --ofmte 6 as shorthand for --ofmt %.6e, etc.
|
||||
--ofmtf {n} Use --ofmtf 6 as shorthand for --ofmt %.6f, etc.
|
||||
--ofmtg {n} Use --ofmtg 6 as shorthand for --ofmt %.6g, etc.
|
||||
--records-per-batch {n} This is an internal parameter for maximum number of
|
||||
records in a batch size. Normally this does not need
|
||||
to be modified.
|
||||
|
|
|
|||
|
|
@ -276,6 +276,9 @@ These are flags which don't fit into any other category.
|
|||
* `--no-hash-records`: See --hash-records.
|
||||
* `--nr-progress-mod {m}`: With m a positive integer: print filename and record count to os.Stderr every m input records.
|
||||
* `--ofmt {format}`: E.g. `%.18f`, `%.0f`, `%9.6e`. Please use sprintf-style codes (https://pkg.go.dev/fmt) for floating-point numbers. If not specified, default formatting is used. See also the `fmtnum` function and the `format-values` verb.
|
||||
* `--ofmte {n}`: Use --ofmte 6 as shorthand for --ofmt %.6e, etc.
|
||||
* `--ofmtf {n}`: Use --ofmtf 6 as shorthand for --ofmt %.6f, etc.
|
||||
* `--ofmtg {n}`: Use --ofmtg 6 as shorthand for --ofmt %.6g, etc.
|
||||
* `--records-per-batch {n}`: This is an internal parameter for maximum number of records in a batch size. Normally this does not need to be modified.
|
||||
* `--seed {n}`: with `n` of the form `12345678` or `0xcafefeed`. For `put`/`filter` `urand`, `urandint`, and `urand32`.
|
||||
* `--tz {timezone}`: Specify timezone, overriding `$TZ` environment variable (if any).
|
||||
|
|
|
|||
|
|
@ -2743,6 +2743,39 @@ var MiscFlagSection = FlagSection{
|
|||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "--ofmte",
|
||||
arg: "{n}",
|
||||
help: "Use --ofmte 6 as shorthand for --ofmt %.6e, etc.",
|
||||
parser: func(args []string, argc int, pargi *int, options *TOptions) {
|
||||
CheckArgCount(args, *pargi, argc, 2)
|
||||
options.WriterOptions.FPOFMT = "%." + args[*pargi+1] + "e"
|
||||
*pargi += 2
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "--ofmtf",
|
||||
arg: "{n}",
|
||||
help: "Use --ofmtf 6 as shorthand for --ofmt %.6f, etc.",
|
||||
parser: func(args []string, argc int, pargi *int, options *TOptions) {
|
||||
CheckArgCount(args, *pargi, argc, 2)
|
||||
options.WriterOptions.FPOFMT = "%." + args[*pargi+1] + "f"
|
||||
*pargi += 2
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "--ofmtg",
|
||||
arg: "{n}",
|
||||
help: "Use --ofmtg 6 as shorthand for --ofmt %.6g, etc.",
|
||||
parser: func(args []string, argc int, pargi *int, options *TOptions) {
|
||||
CheckArgCount(args, *pargi, argc, 2)
|
||||
options.WriterOptions.FPOFMT = "%." + args[*pargi+1] + "g"
|
||||
*pargi += 2
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
name: "--load",
|
||||
arg: "{filename}",
|
||||
|
|
|
|||
|
|
@ -536,6 +536,9 @@ MILLER(1) MILLER(1)
|
|||
floating-point numbers. If not specified, default
|
||||
formatting is used. See also the `fmtnum` function
|
||||
and the `format-values` verb.
|
||||
--ofmte {n} Use --ofmte 6 as shorthand for --ofmt %.6e, etc.
|
||||
--ofmtf {n} Use --ofmtf 6 as shorthand for --ofmt %.6f, etc.
|
||||
--ofmtg {n} Use --ofmtg 6 as shorthand for --ofmt %.6g, etc.
|
||||
--records-per-batch {n} This is an internal parameter for maximum number of
|
||||
records in a batch size. Normally this does not need
|
||||
to be modified.
|
||||
|
|
|
|||
|
|
@ -655,6 +655,9 @@ These are flags which don't fit into any other category.
|
|||
floating-point numbers. If not specified, default
|
||||
formatting is used. See also the `fmtnum` function
|
||||
and the `format-values` verb.
|
||||
--ofmte {n} Use --ofmte 6 as shorthand for --ofmt %.6e, etc.
|
||||
--ofmtf {n} Use --ofmtf 6 as shorthand for --ofmt %.6f, etc.
|
||||
--ofmtg {n} Use --ofmtg 6 as shorthand for --ofmt %.6g, etc.
|
||||
--records-per-batch {n} This is an internal parameter for maximum number of
|
||||
records in a batch size. Normally this does not need
|
||||
to be modified.
|
||||
|
|
|
|||
1
test/cases/cli-ofmt/0001/cmd
Normal file
1
test/cases/cli-ofmt/0001/cmd
Normal file
|
|
@ -0,0 +1 @@
|
|||
mlr --ofmte 6 --from test/input/abixy --d2p put -f ${CASEDIR}/mlr
|
||||
0
test/cases/cli-ofmt/0001/experr
Normal file
0
test/cases/cli-ofmt/0001/experr
Normal file
11
test/cases/cli-ofmt/0001/expout
Normal file
11
test/cases/cli-ofmt/0001/expout
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
a b i x y
|
||||
pan pan 1 3.467901e+05 7.268029e-01
|
||||
eks pan 2 7.586800e+05 5.221511e-01
|
||||
wye wye 3 2.046033e+05 3.383185e-01
|
||||
eks wye 4 3.813994e+05 1.341887e-01
|
||||
wye pan 5 5.732889e+05 8.636245e-01
|
||||
zee pan 6 5.271262e+05 4.932213e-01
|
||||
eks zee 7 6.117841e+05 1.878849e-01
|
||||
zee wye 8 5.985540e+05 9.761814e-01
|
||||
hat wye 9 3.144188e+04 7.495508e-01
|
||||
pan wye 10 5.026260e+05 9.526184e-01
|
||||
1
test/cases/cli-ofmt/0001/mlr
Normal file
1
test/cases/cli-ofmt/0001/mlr
Normal file
|
|
@ -0,0 +1 @@
|
|||
$x = $x * 10**6
|
||||
1
test/cases/cli-ofmt/0002/cmd
Normal file
1
test/cases/cli-ofmt/0002/cmd
Normal file
|
|
@ -0,0 +1 @@
|
|||
mlr --ofmtf 6 --from test/input/abixy --d2p put -f ${CASEDIR}/mlr
|
||||
0
test/cases/cli-ofmt/0002/experr
Normal file
0
test/cases/cli-ofmt/0002/experr
Normal file
11
test/cases/cli-ofmt/0002/expout
Normal file
11
test/cases/cli-ofmt/0002/expout
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
a b i x y
|
||||
pan pan 1 346790.144338 0.726803
|
||||
eks pan 2 758679.964790 0.522151
|
||||
wye wye 3 204603.305766 0.338319
|
||||
eks wye 4 381399.393871 0.134189
|
||||
wye pan 5 573288.919802 0.863624
|
||||
zee pan 6 527126.160092 0.493221
|
||||
eks zee 7 611784.060568 0.187885
|
||||
zee wye 8 598554.009106 0.976181
|
||||
hat wye 9 31441.876461 0.749551
|
||||
pan wye 10 502626.005541 0.952618
|
||||
1
test/cases/cli-ofmt/0002/mlr
Normal file
1
test/cases/cli-ofmt/0002/mlr
Normal file
|
|
@ -0,0 +1 @@
|
|||
$x = $x * 10**6
|
||||
1
test/cases/cli-ofmt/0003/cmd
Normal file
1
test/cases/cli-ofmt/0003/cmd
Normal file
|
|
@ -0,0 +1 @@
|
|||
mlr --ofmtg 6 --from test/input/abixy --d2p put -f ${CASEDIR}/mlr
|
||||
0
test/cases/cli-ofmt/0003/experr
Normal file
0
test/cases/cli-ofmt/0003/experr
Normal file
11
test/cases/cli-ofmt/0003/expout
Normal file
11
test/cases/cli-ofmt/0003/expout
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
a b i x y
|
||||
pan pan 1 346790 0.726803
|
||||
eks pan 2 758680 0.522151
|
||||
wye wye 3 204603 0.338319
|
||||
eks wye 4 381399 0.134189
|
||||
wye pan 5 573289 0.863624
|
||||
zee pan 6 527126 0.493221
|
||||
eks zee 7 611784 0.187885
|
||||
zee wye 8 598554 0.976181
|
||||
hat wye 9 31441.9 0.749551
|
||||
pan wye 10 502626 0.952618
|
||||
1
test/cases/cli-ofmt/0003/mlr
Normal file
1
test/cases/cli-ofmt/0003/mlr
Normal file
|
|
@ -0,0 +1 @@
|
|||
$x = $x * 10**6
|
||||
Loading…
Add table
Add a link
Reference in a new issue