title: Remove two substrings from a string
body: <p>I have a list of files like this:</p>
  
  <pre><code>wgEncodeCaltechRnaSeqGm12878R1x75dFastqRep1.fastq.trim.tags.sam
  wgEncodeCaltechRnaSeqGm12878R1x75dFastqRep2.fastq.trim.tags.sam
  wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep1.fastq.trim00.tags.sam
  wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep1.fastq.trim01.tags.sam
  wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep1.fastq.trim02.tags.sam
  wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep2.fastq.trim00.tags.sam
  wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep2.fastq.trim01.tags.sam
  wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep2.fastq.trim02.tags.sam
  wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd2Rep1.fastq.trim00.tags.sam
  wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd2Rep1.fastq.trim01.tags.sam
  </code></pre>
  
  <p>I want to remove the Rd1, Rd2 and .sam stings from their file names. With the following bash script, I can remove the Rd1, Rd2 and .sam strings using two commands.... </p>
  
  <pre><code>for i in $(ls)
  
  do
  
  echo "${i/Rd?/}"
  echo "${i/.sam/}"
  
  done
  </code></pre>
  
  <p>But I want to know how to do the two substitutions in one step
  Do you know how to do it?</p>
  
  <p>Thanks for your time!</p>