title: for loop before grep getting its output from sed
body: <p>I'm trying to use sed for manipulate text from a file, pipe the result to grep but I have for loop before grep, trying this code </p>
  
  <pre><code>sed 's/["."",""("")"]//g' file.txt | for i in ${array[@]}; do if grep -q -i "${array[$i]}";  then echo "${array[$i]}" fi
  done
  </code></pre>
  
  <p>However the problem is that the output from sed is not being piped to sed (through the for loop) </p>
  
  <p>only this works well:</p>
  
  <pre><code>for i in ${array[@]}; do
  sed 's/["."",""("")"]//g' file.txt | if grep -q -i "${array[$i]}";  then echo "${array[$i]}"
  fi
  </code></pre>
  
  <p>done</p>
  
  <p>but the sed command here is redundant in the loop.</p>
  
  <p>How can I make it work?</p>