Extract particular table from a mysqldump file
$ awksqldump dbname.dump.sql tblname
#!/bin/bash
### check parameter
E_NO_ARGS=65
if [ $# -eq 2 ]
then
# Outputs string of specified table only
awk "/Table structure for table .$2./,/UNLOCK TABLES/{print}" $1 > $1.EXTRACTED.sql
elif [ $# -eq 3 ]
then
# Outputs string starting from table1 and ends on beginning of table2
awk "/Table structure for table .$2./,/Table structure for table .$3./{print}" $1 > $1.EXTRACTED.sql
else
echo "Awk Sql Dump
Usage: awksqldump dumpfilename tablename1 [tablename2]
"
exit $E_NO_ARGS
fi