On 30/06/16 14:55, Jonathan McDowell wrote:
On Thu, Jun 30, 2016 at 02:21:23PM +0100, Laurie Brown wrote:
On 30/06/16 13:37, Jonathan McDowell wrote:
On Thu, Jun 30, 2016 at 01:23:43PM +0100, Laurie Brown wrote:
On 30/06/16 12:16, Jonathan McDowell wrote:
Does "grep -r -I 192.168.100.1 /" not do what you want?
That won't work if there are lots and lots of files to search...
Why not?
Because you it can fail with an "Argument list too long" message. It's a right pain, but using xargs as I previously suggested avoids that.
"-r" means recursively grep; you pass a single directory to grep in the same way you pass a single directory to find in your example. The number of files under that directory is irrelevant.
Well, all I can say is that I was bitten by this a long time ago on a Gentoo box, using "-r", and the only way around it was to use xargs. Your mileage may vary, as the Yanks say, but if you google grep and "Argument list too long" you will find many, many people asking how to fix it, and xargs is the consistent answer.
I've never had a problem since and I've been using Linux for well over 20 years.
You use what works for you, that's the beauty of Linux.
Cheers, Laurie.