简体   繁体   中英

Formatting result from scan command in HBASE

I am trying to run 'scan' command on HABSE shell.

scan 'table_name'

I am getting result as this:

ROW                             COLUMN+CELL                                                                             

000001bff3df$94a8a4c0$608812cf column=general:bcc, timestamp=1521624689099, value=                                     
 @bt2ta 
000001bff3df$94a8a4c0$608812cf column=general:cc, timestamp=1521624689099, value=                                      
 @bt2ta                                                                                                                 
 000001bff3df$94a8a4c0$608812cf column=general:from, timestamp=1521624689099, value="Ken Turner" <kmturner@flex.net>    
 @bt2ta

If you look at the result, it is not well formatted. I could not figure out what is ROW and what is COLUMN+CELL.

Que. Is there any way I can format this result for better readability?

The hbase shell is not displaying the result properly due to terminal window limitation. Tr o output the scan result to a file.

  • Go to shell command prompt (not in hbase shell )
  • Execute the below command

    echo "scan 'table_name'" | hbase shell > myText

The output in mytext would not be wrapped on key . Once you have data in the file, you can use shell commands to format is further as per your requirement.

This behavior seems to depend on terminal settings. I see column wrapping when I have TERM=dumb in my environment variables. I don't see it when I have TERM=xterm or TERM=ansi

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM