1. install vim.
2. do something like
:%!grep foo
and you'll be left with only the lines that have foo in them. It's a unixy filter thing.