title: Intersystems Cache SQL shell: How to spool the output of a query to a file?
body: <p>I am trying to create a script in UNIX to query the Cache database. I could get the output but how do I write the output to a file>
  I used the following procedure:</p>
  
  <pre><code>cache &lt;&lt; EOF
  DO \$SYSTEM.SQL.Shell()
  SELECTMODE DISPLAY
  SELECT * from .....
  GO
  EXIT
  EOF
  </code></pre>