awk '{print 3^(NF-2)}' input | sum0 15'721'434 operations total 13'090'754 thanks to "any" 7'805'608 thanks to "target"