0

I need to replace a number using a script, I am using the following command

 for ((i=1; i=<10, i=i+1))
sed '244s/0.8/(0.$i)/' analyze3big.f >> $i.f 

But for some reason it does not work.

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
  • 4
    Well, how does "it does not work" manifest? What did you expect to happen and what exactly happens instead? – ilkkachu Jun 07 '18 at 20:57
  • See [Difference between ' and " on command line (bash)?](https://unix.stackexchange.com/questions/7574/difference-between-and-on-command-line-bash) – steeldriver Jun 07 '18 at 22:07
  • Possible duplicate of [Difference between ' and " on command line (bash)?](https://unix.stackexchange.com/questions/7574/difference-between-and-on-command-line-bash) – DopeGhoti Jun 07 '18 at 22:31

1 Answers1

2

Strong quotes (') prevent variable expansion. Use weak quotes (") instead:

for i in {1..10}; do
    sed "244s/0\.8/(0.$i)/" analyze3big.f >> $i.f 
done
DopeGhoti
  • 73,792
  • 8
  • 97
  • 133