Discussions

Expand all | Collapse all

how to run Bash script in omnisql and capture output in file

Jump to Best Answer
  • 1.  how to run Bash script in omnisql and capture output in file

    Posted 16 days ago
    how to run Bash script in omnisql and capture output in file

    #General


  • 2.  RE: how to run Bash script in omnisql and capture output in file
    Best Answer

    Posted 16 days ago
    Edited by Candido Dessanti 16 days ago

    Hi @Sumit Srivastava,

    If you mean run a sql script from bash an write the output on an external file it quite easy; you have to to redirect the standard output to a file like 

    echo "select count() from flights where dest_state='###state###';" | sed "s/###state###/CA/g" | /omnisql -t -p HyperInteractive >output.out

    if you want to save the results of a query you can use the copy command from omnisql

    copy "select count() from flights where dest_state='CA' to '/home/mapd/output.out'.

    There isn't a spool command like in Oracle's sql*plus of course and for a very simple reason; sql*plues in the past was, believe it or not, a reporting tool, or better a printing tool, so it has a lot of features to format the output, while omnisci is a simple interface to run queries




  • 3.  RE: how to run Bash script in omnisql and capture output in file

    Posted 16 days ago
    query answered.