|
From: | dan1 |
Subject: | Fw: grep recursive problem |
Date: | Fri, 20 Oct 2006 08:46:35 +0200 |
On Thu, Oct 19, 2006 at 10:27:10PM +0200, dan1 wrote:>...or... >find /some/path -name *.php | xargs grep -i i80wordDoing this (by adding the quotes around *.php), the output is the following:grep: regles.php: No such file or directory grep: ./download/audio/Copie: No such file or directory grep: (2): No such file or directory grep: de: No such file or directory grep: configaudio.inc.php: No such file or directory grep: d: No such file or directory grep: amour: No such file or directory grep: du: No such file or directory grep: pere.php: No such file or directoryIf your filenames have spaces in them xargs will get confused. Try find . -name "*.php" -print0 | xargs -0 grep -i i80word This may be your problem, but I can't say for sure. This is the correct way to do what you want and it should work. Hope that helps :-)
Hello, Dan. Yes, this time it is right, this is working perfectly, I get exactly the result expected, nothing more nothing less. Thank you for this! However, I would like to ask it to you all seriously, don't you think that we should consider doing something to grep so that people can use the first command I suggested (grep -r i80word *.php) to get the same result? I really believe that the suggested command is very cumbersome for doing such a simple thing to look into specific file extensions. DOS handles this so easily.. I know shell is not to be compared, but I really believe that many people will just be disappointed by grep because it cannot easily handle this.. and it doesn't seem logical to me neither that *.php isn't applied to all file names in all subdirs.. I would like to start the debate on this: What do you think ? Thanks, Daniel
[Prev in Thread] | Current Thread | [Next in Thread] |