mirror of
https://github.com/johnkerl/miller.git
synced 2026-01-23 02:14:13 +00:00
parent
472b42d094
commit
8fcc1a6419
3 changed files with 36 additions and 4 deletions
|
|
@ -165,4 +165,19 @@ b it is!
|
|||
c is it ...
|
||||
</pre>
|
||||
|
||||
The `ssub` function exists precisely for this reason: so you don't have to escape anything.
|
||||
The [`ssub`](reference-dsl-builtin-functions.md#ssub) function exists precisely for this reason: so you don't have to escape anything.
|
||||
|
||||
## How to apply math to regex output?
|
||||
|
||||
* Use parentheses for capture groups
|
||||
* Use `\1`, `\2`, etc. to refer to the captures
|
||||
* The matched patterns are strings, so cast them to `int` or `float`
|
||||
|
||||
See also the [page on regular expressions](reference-main-regular-expressions.md).
|
||||
|
||||
<pre class="pre-highlight-in-pair">
|
||||
<b>echo "a=14°45'" | mlr put '$a =~"^([0-9]+)°([0-9]+)" {$degrees = float("\1") + float("\2") / 60}'</b>
|
||||
</pre>
|
||||
<pre class="pre-non-highlight-in-pair">
|
||||
a=14°45',degrees=14.75
|
||||
</pre>
|
||||
|
|
|
|||
|
|
@ -89,4 +89,16 @@ GENMD-RUN-COMMAND
|
|||
mlr --oxtab put '$c = ssub($a, "?"," ...")' data/question.dat
|
||||
GENMD-EOF
|
||||
|
||||
The `ssub` function exists precisely for this reason: so you don't have to escape anything.
|
||||
The [`ssub`](reference-dsl-builtin-functions.md#ssub) function exists precisely for this reason: so you don't have to escape anything.
|
||||
|
||||
## How to apply math to regex output?
|
||||
|
||||
* Use parentheses for capture groups
|
||||
* Use `\1`, `\2`, etc. to refer to the captures
|
||||
* The matched patterns are strings, so cast them to `int` or `float`
|
||||
|
||||
See also the [page on regular expressions](reference-main-regular-expressions.md).
|
||||
|
||||
GENMD-RUN-COMMAND
|
||||
echo "a=14°45'" | mlr put '$a =~"^([0-9]+)°([0-9]+)" {$degrees = float("\1") + float("\2") / 60}'
|
||||
GENMD-EOF
|
||||
|
|
|
|||
9
todo.txt
9
todo.txt
|
|
@ -3,12 +3,14 @@ RELEASES
|
|||
* plan 6.1.0
|
||||
o unsparsify -f CSV by default -- ? into CSV record-writer -- ? caveat that record 1 controls all ...
|
||||
o mlr join --left-fields a,b,c
|
||||
o several needs-doc issues
|
||||
https://github.com/johnkerl/miller/issues?q=is%3Aissue+is%3Aopen+label%3Aneeds-documentation
|
||||
o fmt/unfmt/regex doc
|
||||
o FAQ/examples reorg
|
||||
? ??? for doc-string contents search -- ? & mlr help namegoeshere foo ...
|
||||
|
||||
o several needs-doc issues
|
||||
https://github.com/johnkerl/miller/issues?q=is%3Aissue+is%3Aopen+label%3Aneeds-documentation
|
||||
echo "a=14°20" | mlr put '$out=sub($a,"^([0-9]+)°([0-9]+)$","\1\2")'
|
||||
|
||||
k strptime/882
|
||||
k fmtifnum, & recursive fmtnum/fmtifnum
|
||||
k unicode string literals
|
||||
|
|
@ -26,6 +28,9 @@ RELEASES
|
|||
k ?foo and ??foo @ repl help
|
||||
k doc-improves
|
||||
|
||||
d all-contribs check before release
|
||||
> release notes in particular Poshi derekmahar aborruso
|
||||
|
||||
* plan 6.2.0
|
||||
! extended field accessors for #763 and #948 (positional & json.nested)
|
||||
! strict mode
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue