nest explode-in-place iterate

This commit is contained in:
John Kerl 2016-02-17 21:16:25 -05:00
parent 520dd7f665
commit f3a995accc
4 changed files with 20 additions and 19 deletions

View file

@ -82,20 +82,21 @@ static void mapper_nest_usage(FILE* o, char* argv0, char* verb) {
fprintf(o, "\n");
fprintf(o, " %s %s --explode --values --across-fields -f x\n", argv0, verb);
fprintf(o, " with input record \"x=a;b;c,y=d\" produces output records\n");
fprintf(o, " \"y=d,x_1=a,x_2=b,x_3=c\"\n");
fprintf(o, " \"x_1=a,x_2=b,x_3=c,y=d\"\n");
fprintf(o, " Use --implode to do the reverse.\n");
fprintf(o, "\n");
fprintf(o, " %s %s --explode --pairs --across-records -f x\n", argv0, verb);
fprintf(o, " with input record \"x=a:1;b:2;c:3,y=d\" produces output records\n");
fprintf(o, " \"y=d,a=1\"\n");
fprintf(o, " \"y=d,b=2\"\n");
fprintf(o, " \"y=d,c=3\"\n");
fprintf(o, " \"a=1,y=d\"\n");
fprintf(o, " \"b=2,y=d\"\n");
fprintf(o, " \"c=3,y=d\"\n");
fprintf(o, "\n");
fprintf(o, " %s %s --explode --pairs --across-fields -f x\n", argv0, verb);
fprintf(o, " with input record \"x=a:1;b:2;c:3,y=d\" produces output records\n");
fprintf(o, " \"y=d,a=a,b=2,c=3\"\n");
fprintf(o, " \"a=1,b=2,c=3,y=d\"\n");
fprintf(o, "\n");
fprintf(o, "Notes:\n");
fprintf(o, "* With --pairs, --implode doesn't make sense since the original field name has\n");

View file

@ -2978,10 +2978,10 @@ y=d:40,x=a:1;b:2;c:3
y=d:70,x=a:4;b:5
mlr nest --explode --pairs --across-fields -f x ./reg_test/input/nest-explode.dkvp
y=d:40,a=1,b=2,c=3
a=1,b=2,c=3,y=d:40
y=d:50
u=100,y=d:60
y=d:70,a=4,b=5
a=4,b=5,y=d:70
mlr nest --explode --pairs --across-records -f x ./reg_test/input/nest-explode.dkvp
a=1,y=d:40

View file

@ -2,12 +2,12 @@
.\" Title: mlr
.\" Author: [see the "AUTHOR" section]
.\" Generator: ./mkman.rb
.\" Date: 2016-02-17
.\" Date: 2016-02-18
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MILLER" "1" "2016-02-17" "\ \&" "\ \&"
.TH "MILLER" "1" "2016-02-18" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Portability definitions
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -717,18 +717,18 @@ Examples:
mlr nest --explode --values --across-fields -f x
with input record "x=a;b;c,y=d" produces output records
"y=d,x_1=a,x_2=b,x_3=c"
"x_1=a,x_2=b,x_3=c,y=d"
Use --implode to do the reverse.
mlr nest --explode --pairs --across-records -f x
with input record "x=a:1;b:2;c:3,y=d" produces output records
"y=d,a=1"
"y=d,b=2"
"y=d,c=3"
"a=1,y=d"
"b=2,y=d"
"c=3,y=d"
mlr nest --explode --pairs --across-fields -f x
with input record "x=a:1;b:2;c:3,y=d" produces output records
"y=d,a=a,b=2,c=3"
"a=1,b=2,c=3,y=d"
Notes:
* With --pairs, --implode doesn't make sense since the original field name has

View file

@ -2119,18 +2119,18 @@ Examples:
mlr nest --explode --values --across-fields -f x
with input record "x=a;b;c,y=d" produces output records
"y=d,x_1=a,x_2=b,x_3=c"
"x_1=a,x_2=b,x_3=c,y=d"
Use --implode to do the reverse.
mlr nest --explode --pairs --across-records -f x
with input record "x=a:1;b:2;c:3,y=d" produces output records
"y=d,a=1"
"y=d,b=2"
"y=d,c=3"
"a=1,y=d"
"b=2,y=d"
"c=3,y=d"
mlr nest --explode --pairs --across-fields -f x
with input record "x=a:1;b:2;c:3,y=d" produces output records
"y=d,a=a,b=2,c=3"
"a=1,b=2,c=3,y=d"
Notes:
* With --pairs, --implode doesn't make sense since the original field name has