Get output from scans in hbase shell

You can also use here strings too (if your shell supports them):

$ hbase shell <<< "scan 'sometable'" > myoutput.txt

Above I'm doing this in Bash on a Linux system, for example.


I know that this post is quite old but i was searching something about HBase myself and came across with it.

Well i don't know if this is the best way to do it, but you can definitely use the scripting option HBase gives you. Just open a shell (preferably go to the directory bin of HBase) and run

echo "scan 'foo'" | ./hbase shell > myText

where foo is the name of the table you want to scan. If you then open myText you will see the results in there. Hope i helped!


Another option using an EOF here doc, potentially more customizable:

hbase shell <<EOF >myText
scan 'foo'
EOF

Tags:

Hbase