This is probably old news to most people but I need to remember this so I figured I may as well blog it.
I made a mysqldump that just takes all databases into a single file, already I want to kick myself because I know if I ever need to import it there will be troubles because the target database will already have the mysql database etc.
Really I should have used MySQL Parallel Dump that makes files per tables etc and is much faster but it didn’t exist at the time.
So how to pull lines 8596 to 9613 from this big file? It’s trivial with sed:
here is a sample file:
$ cat > file.txt line 1 line 2 line 3 line 4 line 5 ^D $ sed -n '2,4p;4q' file.txt line 2 line 3 line 4
The sed command just tells it the start to end line and also to quit processing when it hits the end line, really kewl.