new altkv verb

This commit is contained in:
John Kerl 2018-08-26 16:25:52 -04:00
parent cf182a514c
commit 6f8dd97afb
11 changed files with 91 additions and 8 deletions

View file

@ -38,6 +38,7 @@
// ----------------------------------------------------------------
static mapper_setup_t* mapper_lookup_table[] = {
&mapper_altkv_setup,
&mapper_bar_setup,
&mapper_bootstrap_setup,
&mapper_cat_setup,

View file

@ -1,6 +1,7 @@
noinst_LTLIBRARIES= libmapping.la
libmapping_la_SOURCES= \
mapper.h \
mapper_altkv.c \
mapper_bar.c \
mapper_bootstrap.c \
mapper_cat.c \

View file

@ -4,6 +4,7 @@
#include "containers/slls.h"
#include "mapping/mapper.h"
extern mapper_setup_t mapper_altkv_setup;
extern mapper_setup_t mapper_bar_setup;
extern mapper_setup_t mapper_bootstrap_setup;
extern mapper_setup_t mapper_cat_setup;

View file

@ -468,6 +468,12 @@ zee wye 8 [0.0314419]*******...[0.75868] [0.134189]*********#[0.976181]
hat wye 9 [0.0314419]#.........[0.75868] [0.134189]*******...[0.976181]
pan wye 10 [0.0314419]******....[0.75868] [0.134189]*********.[0.976181]
mlr altkv
a=b,c=d,e=f
mlr altkv
a=b,c=d,e=f,4=g
================================================================
TRIVIAL RETAINERS

View file

@ -213,6 +213,13 @@ run_mlr --opprint bar -f x,y --lo 0 --hi 1 $indir/abixy
run_mlr --opprint bar -f x,y -c c -x x -b b --lo 0.1 --hi 0.9 -w 20 $indir/abixy
run_mlr --opprint bar --auto -f x,y -w 10 $indir/abixy
run_mlr altkv <<EOF
a,b,c,d,e,f
EOF
run_mlr altkv <<EOF
a,b,c,d,e,f,g
EOF
# ----------------------------------------------------------------
announce TRIVIAL RETAINERS

View file

@ -47,6 +47,19 @@ More information about them can be found <a href="reference-dsl.html">here</a>.
</td> </tr>
</table>
</div>
<!-- ================================================================ -->
<h1>altkv</h1>
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="toggle_by_name('section_toggle_bar');" href="javascript:;">Toggle section visibility</button>
<div id="section_toggle_bar" style="display: block">
<p/> Map list of values to alternating key/value pairs.
POKI_RUN_COMMAND{{mlr altkv -h}}HERE
POKI_RUN_COMMAND{{echo 'a,b,c,d,e,f' mlr --opprint altkv}}HERE
POKI_RUN_COMMAND{{echo 'a,b,c,d,e,f,g' mlr --opprint altkv}}HERE
</div>
<!-- ================================================================ -->
<h1>bar</h1>

View file

@ -319,7 +319,7 @@ OPTIONS
-K Show a bare listing of keywords by name.
VERB LIST
bar bootstrap cat check count-distinct count-similar cut decimate filter
altkv bar bootstrap cat check count-distinct count-similar cut decimate filter
fraction grep group-by group-like having-fields head histogram join label
least-frequent merge-fields most-frequent nest nothing put regularize rename
reorder repeat reshape sample sec2gmt sec2gmtdate seqgen shuffle sort stats1
@ -580,6 +580,10 @@ OPTIONS
For more information, please invoke mlr {subcommand} --help
VERBS
altkv
Usage: mlr altkv [no options]
Given fields with values of the form a,b,c,d,e,f emits a=b,c=d,e=f pairs.
bar
Usage: mlr bar [options]
Replaces a numeric field with a number of asterisks, allowing for cheesy

View file

@ -125,7 +125,7 @@ OPTIONS
-K Show a bare listing of keywords by name.
VERB LIST
bar bootstrap cat check count-distinct count-similar cut decimate filter
altkv bar bootstrap cat check count-distinct count-similar cut decimate filter
fraction grep group-by group-like having-fields head histogram join label
least-frequent merge-fields most-frequent nest nothing put regularize rename
reorder repeat reshape sample sec2gmt sec2gmtdate seqgen shuffle sort stats1
@ -386,6 +386,10 @@ OPTIONS
For more information, please invoke mlr {subcommand} --help
VERBS
altkv
Usage: mlr altkv [no options]
Given fields with values of the form a,b,c,d,e,f emits a=b,c=d,e=f pairs.
bar
Usage: mlr bar [options]
Replaces a numeric field with a number of asterisks, allowing for cheesy

View file

@ -168,7 +168,7 @@ output separator to the given value.
.RS 0
.\}
.nf
bar bootstrap cat check count-distinct count-similar cut decimate filter
altkv bar bootstrap cat check count-distinct count-similar cut decimate filter
fraction grep group-by group-like having-fields head histogram join label
least-frequent merge-fields most-frequent nest nothing put regularize rename
reorder repeat reshape sample sec2gmt sec2gmtdate seqgen shuffle sort stats1
@ -505,6 +505,16 @@ For more information, please invoke mlr {subcommand} --help
.SH "VERBS"
.sp
.SS "altkv"
.if n \{\
.RS 0
.\}
.nf
Usage: mlr altkv [no options]
Given fields with values of the form a,b,c,d,e,f emits a=b,c=d,e=f pairs.
.fi
.if n \{\
.RE
.SS "bar"
.if n \{\
.RS 0

View file

@ -189,6 +189,7 @@ Miller commands were run with pretty-print-tabular output format.
<div class="pokitoc">
<center><b>Contents:</b></center>
&bull;&nbsp;<a href="#Overview">Overview</a><br/>
&bull;&nbsp;<a href="#altkv">altkv</a><br/>
&bull;&nbsp;<a href="#bar">bar</a><br/>
&bull;&nbsp;<a href="#bootstrap">bootstrap</a><br/>
&bull;&nbsp;<a href="#cat">cat</a><br/>
@ -303,6 +304,41 @@ a=wye,x_sum=0.777892
</td> </tr>
</table>
</div>
<!-- ================================================================ -->
<a id="altkv"/><h1>altkv</h1>
<button style="font-weight:bold;color:maroon;border:0" padding=0 onclick="toggle_by_name('section_toggle_bar');" href="javascript:;">Toggle section visibility</button>
<div id="section_toggle_bar" style="display: block">
<p/> Map list of values to alternating key/value pairs.
<p/>
<div class="pokipanel">
<pre>
$ mlr altkv -h
Usage: mlr altkv [no options]
Given fields with values of the form a,b,c,d,e,f emits a=b,c=d,e=f pairs.
</pre>
</div>
<p/>
<p/>
<div class="pokipanel">
<pre>
$ echo 'a,b,c,d,e,f' mlr --opprint altkv
a,b,c,d,e,f mlr --opprint altkv
</pre>
</div>
<p/>
<p/>
<div class="pokipanel">
<pre>
$ echo 'a,b,c,d,e,f,g' mlr --opprint altkv
a,b,c,d,e,f,g mlr --opprint altkv
</pre>
</div>
<p/>
</div>
<!-- ================================================================ -->
<a id="bar"/><h1>bar</h1>

View file

@ -1439,11 +1439,11 @@ Help options:
-K Show a bare listing of keywords by name.
Verbs:
bar bootstrap cat check count-distinct count-similar cut decimate filter
fraction grep group-by group-like having-fields head histogram join label
least-frequent merge-fields most-frequent nest nothing put regularize rename
reorder repeat reshape sample sec2gmt sec2gmtdate seqgen shuffle sort stats1
stats2 step tac tail tee top uniq unsparsify
altkv bar bootstrap cat check count-distinct count-similar cut decimate
filter fraction grep group-by group-like having-fields head histogram join
label least-frequent merge-fields most-frequent nest nothing put regularize
rename reorder repeat reshape sample sec2gmt sec2gmtdate seqgen shuffle sort
stats1 stats2 step tac tail tee top uniq unsparsify
Functions for the filter and put verbs:
+ + - - * / // .+ .+ .- .- .* ./ .// % ** | ^ &amp; ~ &lt;&lt; &gt;&gt; bitcount == != =~