How to multiply two columns in awk?
awk '{ print $1, $1 * $2 }' input.txt > output.txt
Here is an awk
solution:
$ awk '$0=$1" "$1*$2' input.txt
1 677679866
2 243735232
3 148239594
4 161663928
But you can do it many ways, here is a perl
solution:
$ perl -ape 's/$F[1]/$F[0]*$F[1]/e' input.txt
1 677679866
2 243735232
3 148239594
4 161663928
You can make change inplace, by using -i
option:
$ perl -i.bak -ape 's/$F[1]/$F[0]*$F[1]/e' input.txt