Some days ago a friend asked me how to extract a single database from a complete database dump. He created the dump using mysqldump and only wanted to restore a single database, without having go through >80k lines.
After a little thinking I came up with a little script that does the work:
I used grep to find the line of where the database is created and cut to extract the line number. Sed can be used to extract lines or a range of lines from a text file.
sed -n 1,10p file
This extracts lines 1 to 10 from a file. It's pretty amazing what sed can be used for..