Permalink
Browse files

Added.

  • Loading branch information...
1 parent ce9ea40 commit e065d8732482bd25725d6d1841a67e116c182cbd @mv committed Dec 21, 2009
Showing with 24 additions and 0 deletions.
  1. +24 −0 mysql/kount.sh
View
@@ -0,0 +1,24 @@
+#!/bin/bash
+#
+# mysql count tables
+#
+# Marcus Vinicius Ferreira ferreira.mv[ at ]gmail.com
+# 2009/12
+
+[ -z "$1" ] && {
+
+ echo
+ echo "Usage: $0 dbname"
+ echo
+ exit 1
+}
+
+dbname="$1"
+
+mysql -B -N -e "SHOW TABLES" $dbname \
+| sort \
+| awk '{print "select '"'"'" $1 "'"'"', count(*) as qtd from ", $1, ";"}' \
+| mysql -N $dbname \
+| column -t
+
+

0 comments on commit e065d87

Please sign in to comment.