title: read a file to EOF in shell/bash in while loop pipe seperated - shell script
body: <p>I would like to read a file to EOF which has multiple sql queries separated by pipe or double pipe. Choosing pipe because tab, \n and space are could already be present in queries. The queries can span to multiple lines. Each query needs to be read into a variable and inside the while loop, I would like to run a command/SQL query on a DB using that querystring variable. The loop has to do this for all querystrings created from the file. </p>
  
  <p>Example file Contents: </p>
  
  <pre><code>select * from blah;||select column from table1;||select column7 from table4;EOF
  </code></pre>
  
  <p>This is my script so far:</p>
  
  <pre><code>while IFS=$'||' read -r querystring
  do
   run some shell command on ${querystring} 
  done &lt; myqueryfile.sql
  </code></pre>
  
  <p>This is how much I got so far. thoughts/comments appreciated</p>