grep won't do (exactly) what you've requested.
you're going to have to use sed or perl and delete chars before, between, and after the pattern you seek.
One option of grep, '-o' will print only the matching pattern, however it will
break each match onto its own line, not preserving your pairs.
Maybe that's what your teacher wanted you to figure out on your own?
Last edited by _bsd; 11-07-2011 at 08:11 AM.
Reason: double checked my own facts