Louie Crew's Tricks:unix:grep:Finding Things
Finding Things in Your Own Files
Very soon you will collect so much material that you may have trouble
finding it. Andromeda has a powerful command to help you, called grep.
Here's a session that I just had. At the pegasus prompt, I entered:
grep "Leviticus, Alabama" */*
The program reported these "finds" in files all over my pegagus
directory:
religion.christian:Z. Strange Lott, a patriarchal millionnaire from
religion.misc:Z. Strange Lott, a patriarchal millionnaire from Lev
Note:
The command essentially looked for the text string
"Leviticus, Alabama" in every file that I have and to report where it
appears. It found the two lines where that text appeared and reported
both the file names and the line in which the text appeared.
If I expect to find more than a screenful of lines, it is helpful to
redirect the output the findings into a file (here I named the file "1")
and then to page through the findings:
grep "Leviticus, Alabama" */* >1
pg 1
Here are the items I discovered:
religion.christian:Z. Strange Lott, a patriarchal millionnaire from
religion.misc:Z. Strange Lott, a patriarchal millionnaire from Lev
"pg" tells andromeda to show me one page at a time. Obviously I did
not need to use this method for a list of findings this short.
One extra fix that you might want to know.....
grep "string" */* |pg
is better than
grep "string" */* >1;pg 1
because the first version does not leave around garbage files...
assuming that you are not interested in keeping the list for a
longer time.....
Enjoy.
Send mail to: lcrew@andromeda.rutgers.edu