diff -r a39066264509 -r 2868d772c27e relpipe-data/examples-awk-aggregations.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/relpipe-data/examples-awk-aggregations.xml Tue May 28 21:18:20 2019 +0200 @@ -0,0 +1,90 @@ + + + Aggregating data with AWK + counting records and computing sum or appending new records + 02600 + + + +

+ We have filtered records, modified attribute values, added and removed attributes, dropped a relation… + and there is one more operation that we can do with AWK: INSERT resp. appending or preppending additional records to the relation + – and we can also completely replace the record set by skipping the original records. +

+ +

Adding records

+ +

+ Using options --before-records and --after-records we can pass additional AWK code that will be executed – once for given relation. + The record() function will then generate an additional record (can be called multiple times and generate more records): +

+ + + +

Which will INSERT one new record:

+ +
+ +

Counting and summarizing values

+ +

We can also compute some statistics like COUNT() and SUM():

+ + + +

and get result:

+ +
+ +

Where the total_size is the same as will du compute:

+ +
find . -type f -print0 | du -b -c --files0-from=-
+ +

Analogously we can compute minimum, maximum etc. using AWK transformation.

+ +
+ +