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 with awk
. (And the use of sed
in this case is too difficult.) So, here is my solution using awk
:
$ echo "block: 16, size: 16, start: 8, length: 4" | awk '{
printf "%s %d, %s %d, %s %d, %s %d
", $1, $2/2, $3, $4/2, $5, $6*2, $7, $8*2
}'
block: 8, size: 8, start: 16, length: 8
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…