v2.3.0
This version has a dictionary of litst, which is named K
. K
is useful when we want to store values for each key.
### example data###
$ cat data
a 100
b 2
a 10
b -1
a 10000
### output values as a list for each key ###
$ cat data | opy '{K[F1].append(F2)};E:{p_(K)}'
a [100, 10, 10000]
b [2, -1]
### output the maximum value for every key ###
$ cat data | opy '{K[F1].append(F2)};E:{x={k:max(K[k]) for k in K}};E:{p_(x)}'
a 10000
b 2