How to multiply two columns in awk

awktext processing

I want to multiply column 1 with column 2 (till end of file) in input file and should output 1 column and multiplied 3 column in separate file.

input.txt :

1 677679866
2 121867616
3 49413198
4 40415982

output.txt :

1 677679866
2 243735232
3 148239594
4 161663928

Best Answer

awk '{ print $1, $1 * $2 }' input.txt > output.txt
Related Question