How to dump the output to a file from Beeline?

https://community.hortonworks.com/questions/25789/how-to-dump-the-output-from-beeline.html

Hi,

I am trying to dump the output of a beeline query (below) to a file but it prints all the logs along with the output in the file.

beeline u jdbc:hive2://somehost_ip/ -f hive.hql >op.txt

Here is the output

0: jdbc:hive2://10.211.1.5:10000/> use db;
0: jdbc:hive2://10.211.1.5:10000/> select count(*) from sample_table;
+------+--+
| _c0  |
+------+--+
| 131  |
+------+--+
0: jdbc:hive2://10.211.1.5:10000/>
0: jdbc:hive2://10.211.1.5:10000/>
0: jdbc:hive2://10.211.1.5:10000/>

Can someone let me know how to get the output alone in a file as we get using Hive?

   --showHeader=[true/false]       show column names in query results
   --headerInterval=ROWS;          the interval between which heades are displayed
   --fastConnect=[true/false]      skip building table/column list for tab-completion
   --autoCommit=[true/false]       enable/disable automatic transaction commit
   --verbose=[true/false]          show verbose error messages and debug info
   --showWarnings=[true/false]     display connection warnings
   --showNestedErrs=[true/false]   display nested errors
   --numberFormat=[pattern]        format numbers using DecimalFormat pattern
   --force=[true/false]            continue running script even after errors
   --maxWidth=MAXWIDTH             the maximum width of the terminal
   --maxColumnWidth=MAXCOLWIDTH    the maximum width to use when displaying columns
   --silent=[true/false]           be more silent
   --autosave=[true/false]         automatically save preferences
   --outputformat=[table/vertical/csv2/tsv2/dsv/csv/tsv]  format mode for result display
                                   Note that csv, and tsv are deprecated - use csv2, tsv2 inste

2 Responses so far.

  1. Peggy says:
    jeg skal have den ene af cd’erne, for og &#2re0;d2ill8r” mine veninder, med og gÃ¥ og synge dem hele tiden og jeg bor i en lille landsby, sÃ¥ nok ingengang fÃ¥r den?. Og sÃ¥ kan jeg mÃ¥ske fÃ¥ nogle flere af mine venner til og kunne lide ham! derfor skal jeg have den flotte & gode cd! 😀 hihi
  2. prasad says:
    beeline –u jdbc:hive2://somehost_ip/ –silent=true -f hive.hql >op.txt

Leave a Reply to Peggy Cancel reply