Fundamental UNIX utilities
grep
is your friend
More about regular expressions
More handy UNIX text-processing tools