miller/doc/data/two-pass-record-numbers.sh
2016-07-03 00:19:51 -04:00

11 lines
252 B
Bash

mlr --opprint --from data/small put -q '
@records[NR] = $*;
end {
for((I,k),v in @records) {
@records[I]["I"] = I;
@records[I]["N"] = NR;
@records[I]["PCT"] = 100*I/NR
}
emit @records,"I"
}
' then reorder -f I,N,PCT