From time to time, you’ll need to look at data within MySQL dump files, specifically I do it mostly with WordPress. There isn’t an easy way to search the dump unless you use grep. Here are some useful grep commands.

Pull out a table.

grep 'INSERT INTO `wp_bspr_users`’ dump.sql > /tmp/users.sql

Format a table in a readable format.

cat dump.sql | grep 'INSERT INTO `wp_users`' | sed 's/),/'$'n/g’

Now if you run a popular shell like csh, you can add the following function.

msd () { grep "INSERT INTO \`$2\`" $1 | sed "s/),/\'$'\n/g" }

Then run the following

msd dump.sql wp_users

This might work, don’t know!