On Thu, 2016-06-30 at 11:14 +0100, Mark Rogers wrote:
Is there a quick way to search all text files for a string?
By "text file" I mean ASCII files, like log files, config files etc, but excluding binaries like executables, database files, etc?
What I want is something like: find / -type a -exec grep 192.168.100.1 {} ; .. or similar, except that I made up "-type a" for ascii.
(I'm trying to find all places that an IP address is mentioned so that I can change ones that need to be changed.)
Given that the "file" command can recurse through directories, I would have thought there was mileage in something like;
grep '192.168.1.1' `file -r | grep ascii | awk -F: {print $1}`
Yes, yes, I know this is hideous and an 'xargs' would be good in there somewhere, but it's just a suggestion to start from!