[Courses][Linux comands] Finding things with locate, find, and grep

SML parallax at lafn.org
Wed Feb 18 16:27:09 EST 2004


> grep - options - search string - file to search
> The -w flag means 'whole word search.' Which is really handy, because 
> otherwise grep returns every single line that contains your search
> string. 

Wow. That's a lot of stuff to go through. Give me a few days to work
through the commands and I'll come back with questions.

But one thing that I've always wanted is to be able to grep through a
file(s) and have the line number where the grep'ed word(s) was/were
located. That is, I'd like to grep a file for a generic error message,
and have the result return a line number where I can quickly get to via
vi or some other editor to look as the lines just above to see what
might have caused the error.

Is there anyway do to this?

Thanks.

SML


More information about the Courses mailing list