bash command: grep
How long should it take to run this command on say 50 MB of files? I am using the command 'grep "some text" ./* -ras' on a directory that is the root of a damn small linux filesystem I am reworking the iso. It has been running for two days. Is this normal? Is there a faster way to search through that many files to find what contains certain text?
|
No, it's not normal. How much is grep taking in the way of CPU resources? How much harddrive activity is there? If they're both very very low then I'd guess that grep is waiting for keyboard input.
fgrep is faster than grep if you don't need the use of regular expressions. |
doesn't seem to be using anything for resources except it shows it as an active process when i do ps. What kind input? is there somethingwrong with the command i typed? If I don't tell it to ignore the not found files with the -s it does list some /bin files. What would be a better way to find a string of text in that many files?
|
find -type f -exec grep "text" {} \;
Cheers, Tink |
that gave back the line of text that contained the text but it did not tell me what files it was in. I actually need the file that contains the text. Thank you for the reply.
|
ok i got it. I did:
find -type f -exec grep -H "text" {} \; |
If you only need the name use
Code:
grep -l Cheers, Tink |
All times are GMT -5. The time now is 02:04 AM. |