I have a file with several columns and I want to multiply by a constant the first half elements of these columns over a range of lines. For example, if I had only 4 columns and 2 lines:
8 2 4 5
6 12 8 8
The output I want (supposing the multiplicative constant is 1/2
) would be the following:
4 1 4 5
3 6 8 8
I have no glue how to do it, I suppose that bc
will help...
You can use
awk
like this for processing your file on row/col basis: