title: Modify the content of variable using sed (or something similar)
body: <p>I wrote a  BASH file that features multiple embedded loops of the form </p>
  
  <pre><code>for P in {'0.10','0.20', [...] '0.90','1.00'}; do 
     for Q in {'0.10','0.20', [...] ,'0.90','1.00'}; do
      [...] 
  </code></pre>
  
  <p>I use these variables both as parameters for a command line application, and to create file names directly in BASH. I would like to create duplicates, say <code>$P_REP=0_10</code> that replaces the dot by an underscore  without writting a explicit switch statement for every case, or some hardcoded equivalent. The (non-elegant way) I found to go about it is to </p>
  
  <ol>
  <li>dump the content of <code>P,Q</code> to a temporary file.</li>
  <li>replace the dot by an underscore using <code>sed 's/./_/ -i</code>.</li>
  <li>read the file again and load its content to the new variable. </li>
  </ol>
  
  <p>Hence, I was wondering if it is possible to run a sed like command directly on the content of a variable? </p>