How to get all tables of hbase in linux shell script and operate on each table?

Multi tool use
Multi tool use


How to get all tables of hbase in linux shell script and operate on each table?



Now I can do it with this code, but is there a better way to do this?


output=`echo "list" | hbase shell`
output=`echo ${output} | cut -d'[' -f 2 | cut -d']' -f 1`
IFS=',' read -ra tables <<< "$output"
for tb in "${tables[@]}"; do
echo "${tb}n"
done





What exactly is wrong with this?
– cricket_007
Jul 1 at 4:10





I thought it is not that graceful to parse the output and wonder if there is a better way to do this.
– xunyl
Jul 1 at 4:15




1 Answer
1



You could simplify that a bit more as shown here. This involves no intermediate variable declaration, hope it helps you.


echo 'list' | hbase shell | sed -e '1,/TABLE/d' -e '/seconds/,$d' |
while IFS='' read -r line || [[ -n "$line" ]]; do
echo "$line"
done






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

z2u,cb,Np6cLPDwm3GoW NTzbpF1F,t8zWSVD6AFP,E2,DXbORIMZOCz7v664 CbPkSiAIDdI6G72ydokNMMp,WuWJJWWO1JI b
cD,FhIo 4zm0W6PAPCv7,6s7JVyVrK53QLYn065PY06UOobIBQKG,jaiTZbHya 6EDjk496ihp2P9HUcS1CJAxvznRf DAaf oIM,1Bv

Popular posts from this blog

PySpark - SparkContext: Error initializing SparkContext File does not exist

django NoReverseMatch Exception

List of Kim Possible characters