hbasehbase-shell

Export data from HBase shell


Im trying to export data from HBase Shell to a text file which I can parse, and add to a msysql db.

I am currently using the following command:

echo "scan 'registration',{COLUMNS=>'registration:status'}" | hbase shell > registration.txt

which exports everything from the hbase shell to the registration.txt.

How can I remove the shell intro, and the summary and just append the rows of data to the text file:

Eg: Shell into I want to omit:

HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.94.5-mapr, Wed May  1 7:42:07 PDT 2013

Summary I want to omit:

ROW                                      COLUMN+CELL  
4419 row(s) in 12.9840 seconds

Solution

  • Try this

    echo "scan 'registration',{COLUMNS=>'registration:status'}" | hbase shell | grep "^ " > registration.txt
    

    Since the results are prefixed with single space, remaining stuff would be filtered out.