title: shell script to pass file names and run through
body: <p>I have list of file names file1,file2,file3<br>
  I want to pass these file names in the script and remove the special characters  </p>
  
  <p>I prepared sed command to remove the special characters  </p>
  
  <pre><code>sed  -i -e 's/^B/,/g' /home/data/nfiledata/ 
  hdfs dfs -put -f /home/data/nfiledata/*  user/sai/table1/nfiledata/
  gzip  /home/data/nfiledata/*
  </code></pre>
  
  <hr>
  
  <pre><code>sed  -i -e 's/^B/,/g' /home/data/marginfile/  
  hdfs dfs -put -f /home/data/marginfile/*  user/sai/table2/marginfile/
  gzip  /home/data/marginfile/*
  </code></pre>
  
  <hr>
  
  <pre><code>sed  -i -e 's/^B/,/g' /home/data/calldata/  
  hdfs dfs -put -f /home/data/calldata/*  user/sai/table3/calldata/
  gzip  /home/data/calldata/*
  </code></pre>
  
  <p>My question is instead of writing multiple times same command can i write  in one command and loop the process for each file using Shell script  </p>
  
  <pre><code>nfile = (nfiledata,margindata, calldata)
  while IFS= read -r nfile
  do
    sed  -i -e 's//,/g' /home/data/$nfile/
    hdfs dfs -put -f /home/data/$nfile/*  user/sai/table$/$nfile/
    gzip  /home/data/$nfile/*
  done &lt; "home/data/$nfile"
  </code></pre>