title: How to replace string in file and run command after in a loop
body: <p>I want to replace a line in a file called <code>link.j</code> and run a program after it, when the program is done I want to run it again but with a different replacement for the <code>link.j</code> file as in a loop for all the values specified by me.</p>
  <p>So for replacing the one line I have done</p>
  <pre><code>sed -i '' -e '3 s/0.5/0.1/' link.j
  </code></pre>
  <p>then run</p>
  <pre><code>copy.sh
  </code></pre>
  <p>So I replace the value of the third line from <code>0.5</code> to <code>0.1</code>. Now I want to keep doing it but for values ranging from <code>0.1</code> to <code>1.0</code> spaced out <code>0.1</code> apart, so <code>0.1,0.2...1.0</code>, and always running the code after.</p>
  <p>The code, that I run after, copies the file which I just modified into a new subfolder, so I would like to save these folders before I would run the substitution again.</p>
  <p>The copy.sh script looks like this</p>
  <pre><code>for dir in `ls -d ../files/files-12/??`
  do
  
  id=`echo $dir | awk -F/ '{print $4}'`
  mkdir $id
  
  cp ../stack/*/${id}/rf* .
  done
  </code></pre>