[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-grep] Grep bug
From: |
Stepan Kasal |
Subject: |
Re: [bug-grep] Grep bug |
Date: |
Fri, 4 Mar 2005 08:15:03 +0100 |
User-agent: |
Mutt/1.4.1i |
Hello,
On Thu, Mar 03, 2005 at 10:36:41AM -0500, Edna Reid wrote:
> When I invoke grep on the command it return nothing even the file is
> there and I can also vi the file.
a guess: perhaps you misunderstood the purpose of grep.
It's purpose is to find text contained in files, not to find whole files.
For example:
grep -i moo animals.txt
searches of occurences of "moo" in file animals.txt and
grep -i moo *.txt
searches for occurences of "moo" in all *.txt files in current directory.
If you want to search a whole subtree, you can use something like
grep -i -r moo .
or
grep -ir moo dirname
To search files, according to their name, you have to use find, like this
find . -name '*.txt' -iname '*moo*'
or
find . -iname '*moo*.txt'
searches for *.txt files whose _names_ contain the string "moo".
> Dell 2650 server linux es os
This implies you are using GNU grep. You could determine the version of
grep by "grep --version", which would be important for bug report.
But if my guess was true and you have misunderstood how grep is used,
a fine manual could help you. When you run "info find", you get
a manual to find; it's also on the web:
http://www.gnu.org/software/findutils/manual/html_node/find_html/index.html
or dowloadable in various formats
http://www.gnu.org/software/findutils/manual/find.html
Similarily, the grep manual can be accessed by "info grep" on your computer,
or on the web: http://www.gnu.org/software/grep/doc/grep.html
Unfortunately, the grep manual is morover a reference, not a tutorial;
a book covering basics of unix or GNU/Linux could serve better here.
Have a nice day,
Stepan Kasal