title: Replace special characters in variable in awk shell command
body: <p>I am currently executing the following command:</p>
  
  <pre><code>awk 'BEGIN { FS="," ; getline ; H=$0 } N != $3 { N=$3 ; print H &gt; "/Directory/FILE_"$3"_DOWNLOAD.csv" } { print &gt; "/Directory/FILE_"$3"_DOWNLOAD.csv" }' /Directory/FILE_ALL_DOWNLOAD.csv
  </code></pre>
  
  <p>This takes the value from the third position in the CSV file and creates a CSV for each distinct $3 value. Works as desired.</p>
  
  <p>The input file looks as follows:</p>
  
  <pre><code>Name, Amount, ID
  "ABC", "100.00", "0000001"
  "DEF", "50.00", "0000001"
  "GHI", "25.00", "0000002"
  </code></pre>
  
  <p>Unfortunately I have no control over the value in the source (CSV) sheet, the $3 value, but I would like to eliminate special (non-alphanumeric) characters from it. I tried the following to accomplish this but failed...</p>
  
  <pre><code>awk 'BEGIN { FS="," ; getline ; H=$0 } N != $3 { N=$3 ; name=${$3//[^a-zA-Z_0-9]/}; print H &gt; "/Directory/FILE_"$name"_DOWNLOAD.csv" } { print &gt; "/Directory/FILE_"$name"_DOWNLOAD.csv" }' /Directory/FILE_ALL_DOWNLOAD.csv
  </code></pre>
  
  <p>Suggestions? I'm hoping to do this in a single command but if anyone has a bash script answer that would work.</p>