tags:

views:

85

answers:

2

I want to subtract a column from 100 using awk. I have tried

awk '{ t = 100-$2 } END { print t }' /alps/average.log

It gave me only the last value subtracted. How it can be accomplished if I want the whole column outputted on terminal?

A: 

print t in an unlabeled block, definitely not in one labeled END!

Alex Martelli
+3  A: 

Try this:

awk '{print 100-$2}' /alps/average.log

Commands after the END label are executed only after end of file.

mouviciel