File I need to modify contains the following:
block: 16, size: 16, start: 8, length: 4
I’d like the file so that values for block, size will be divided by 2 while values for start, length will be multiplied by 2.
Since I have to make such modifications for a whole bunch of files, I am considering using Sed to do the substitution work for me. But I’m not sure calculations are allowed in the matching and substituting process.
I always try to solve every problem tagged with sed using
sed. But here it would be so easy to accomplish what you are trying to do withawk. (And the use ofsedin this case is too difficult.) So, here is my solution usingawk: