arithmetic calculation using awk

hi there again,

i need to do a simple division with my data with a number of rows. i think i wanted to have a simple output like this one:

col1 col2 col3
val1 val2 val1/val2
valn valm valn/valm

any suggestion is very much appreciated. thanks much.

Something like this:

awk ' { printf( "%s %s %.2f\n", $1, $2, $1/$2 ); }' input-file

should work.

Change the 2 in %.2f to be the number of places after the decimal you'd like if two isn't suitable.

thank u very much. :slight_smile: