As part of a makefile recipe, I want to repeatedly adjust a few lines in some text file
txt.in. In particular, I want to update, among others, the third line which contains simply two numbers separated by a space. They should be formatted as
0.00 0.00. As such, I've included the code below in my makefile to test whether I can do this.
# Makefile to test for-loop SHELL=/bin/zsh for: for k in 1 2 3; do \ let n="$$k*0.25"; \ let m="$$n+0.25"; \ sed -i "3s/.*/$$n $$m/" txt.in; \ done
0.7500000000 1.0000000000 as the end result. There may be more efficient ways to do this and I'd be happy to find out about those, but the thing I'd really like to find out is if there's a way to get the format right.