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

Jeannette jcv at hise.org
Wed Feb 18 16:40:51 EST 2004


Oooh ooh! (Waving hand wildly!)
I have spent the week doing exactly that!

-n or --line-number will print the line number, so, e.g.,
grep -n drive October1.html

returns:
1657: this test, the drive is able to supply data at its maximum rate
1673: seen from this drive. Since results were so consistent, however,

Jeannette

On Wed, 18 Feb 2004, SML wrote:

> > 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
> _______________________________________________
> Courses mailing list
> Courses at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/courses
>



More information about the Courses mailing list