more count_table_count.sh #! /bin/bash >table_count.txt mysql -uroot -p123123 -h192.168.10.100 -e "use rrmj;show tables;"|sed ‘/Tables_in_rrmj/d;/category/d;/duplicate_user/d;/login_user/d;/resource/d;/resource_category_rel/d;/resource_detail/d;/tmp/d;/user/d‘ >tables.txt for table in `cat tables.txt` do echo "$table">>count.txt mysql -uroot -p123123 -h192.168.10.100 -e "use rrmj;select count(*) from $table;">>count.txt done sed -i "/\*/d" count.txt sed -i ‘$!N;s/\n/ /‘ count.txt sort -k 2 -nr count.txt >table_count.txt rm -f count.txt rm -f tables.txt
效果如下截图:
时间: 2024-10-12 22:38:32