A few days ago I showed a quick way to extract one table form a mysqldump output. Here is a more complete version which supports extracting either a full schema or a table from the specified schema. If full schema is being extracted, the script also looks for any associated views and routines.
Usage is simple:
garfield ~ # ./extract.sh -f dump.sql -d redmine >
redmine.sql
garfield ~ # ./extract.sh -f dump.sql -d redmine -t workflows
> redmine-workflows.sql
You can grab the script from Downloads page.
extract.sh
#!/bin/bash # # Extracts a schema or a table from a text dump generated by mysqldump or phpMyAdmin # (c) 2012 Maciej Dobrzanski http://www.dbasquare.com/ # Released under GNU General Public License, version 2 # function help() { cat <<EOF Usage: [-h] -f <dump file> -d <database …[Read more]