Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added.

  • Loading branch information...
commit e065d8732482bd25725d6d1841a67e116c182cbd 1 parent ce9ea40
Marcus Vinicius Ferreira authored

Showing 1 changed file with 24 additions and 0 deletions. Show diff stats Hide diff stats

  1. 24  mysql/kount.sh
24  mysql/kount.sh
... ...
@@ -0,0 +1,24 @@
  1
+#!/bin/bash
  2
+#
  3
+# mysql count tables
  4
+#
  5
+# Marcus Vinicius Ferreira                          ferreira.mv[ at ]gmail.com
  6
+# 2009/12
  7
+
  8
+[ -z "$1" ] && {
  9
+
  10
+    echo
  11
+    echo "Usage: $0 dbname"
  12
+    echo
  13
+    exit 1
  14
+}
  15
+
  16
+dbname="$1"
  17
+
  18
+mysql -B -N -e "SHOW TABLES" $dbname    \
  19
+| sort \
  20
+| awk '{print "select '"'"'" $1 "'"'"', count(*) as qtd from ", $1, ";"}'    \
  21
+| mysql  -N                  $dbname    \
  22
+| column -t
  23
+
  24
+

0 notes on commit e065d87

Please sign in to comment.
Something went wrong with that request. Please try again.