title: Parameter expansion to remove strings with multiple patterns
body: <p>I'm building a script that sends the "find" command output to a temp file and from there I use "read" to iterate through all the paths and print two fields into a csv file, one field for the name of the file and the other for the complete path.</p>
  
  <pre><code>find -type f \( -iname \*.mp4 -o -iname \*.mkv \) &gt;&gt; $tempfile
  while read -r file; do
      printf '%s\n' ${file##*/} ${file} | paste -sd ' ' &gt;&gt; $csvfile
  done &lt; $tempfile
  rm $tempfile
  </code></pre>
  
  <p>The problem is in the field for the names <code>${file##*/}</code>. Some files have spaces in their names and this is causing they not being printed correctly in the csv file, I know I could use this <code>${file//[[:blank:]]/}</code> to remove the spaces but I also need to preserve this <code>${file##*/}</code> since that parameter expansion allows me to cut all but the name itself of my files (and print those in the first field of the csv file).</p>
  
  <p>I was searching for a way to kinda join the two parameter expansion <code>${file##*/}</code> and <code>${file//[[:blank:]]/}</code> but I didn't found anything related. Is it possible to solve this using only parameter expansion?, if no what other solutions can fix this? maybe regex?</p>
  
  <p>Edit: Also I will need to add a 3rd field in which the value will depend on a variable.</p>