AWK syntax problem

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

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

      

This only gave me the last value to subtract. How can this be done if I want the entire column to be output to the terminal?

+1


a source to share


2 answers


Try the following:

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

      



The commands after the label END

are executed only after the file is finished.

+5


a source


print t

in an unmarked block, definitely not one tagged one END

!



0


a source







All Articles