Search for a substring in multiple files

(imported topic written by Mark_Macherey)

Im trying to search multiple files for a substring, true/false if all I need, if any files don’t contain the string it should fail

I want to seach all drives in the Oracle directorys for a file called ldap.ora and search those files for a substring called “tnsnames.server.com” and if any single doesnt have it, it would fail… or it could return all the pathnames of the files that dont have it in the file

Q: (pathnames of find files “ldap.ora” of (descendant folders of folder “\oracle”)of drives whose (type of it=“DRIVE_FIXED”))

A: \oracle\1\1\ldap.ora

A: \oracle\2\ldap.ora

T: 2.861 ms

Q: (pathnames of descendants whose (name of it as lowercase = “ldap.ora” ) of folders “\oracle” of drives whose (type of it=“DRIVE_FIXED”))

A: C:\oracle\1\1\ldap.ora

A: C:\oracle\2\ldap.ora

T: 1.726 ms

This lumps all the files together and gives a true if any file has the substring

Q: exists lines whose (it does not start with “#” AND it as trimmed string contains “tnsnames.server.com”) of files (pathnames of find files “ldap.ora” of (descendant folders of folder “\oracle”)of drives whose (type of it=“DRIVE_FIXED”))

A: True

T: 3.435 ms

(imported comment written by MattPeterson)

I think something like this should work (none of this tested :):

This should give you multiple true/false answers (plural boolean)

q: (exists lines whose (it does not start with “#” AND it as trimmed string contains “tnsnames.server.com”) of file it) of (files (pathnames of find files “ldap.ora” of (descendant folders of folder “\oracle”)of drives whose (type of it=“DRIVE_FIXED”)))

This should give you a single true/false (singular boolean)

q: concatenation of ((if exists lines whose (it does not start with “#” AND it as trimmed string contains “tnsnames.server.com”) of file it then “true” else “false”) of (files (pathnames of find files “ldap.ora” of (descendant folders of folder “\oracle”)of drives whose (type of it=“DRIVE_FIXED”)))) contains “true”

(imported comment written by jgstew)

This is also not tested and based upon Matt’s answer. It should return false if the string is missing from any of the files and return true if the string is present in all of the files.

(conjunction of (exists lines whose (it does not start with “#” AND it as trimmed string as lowercase contains “tnsnames.server.com”) of it) of (find files “ldap.ora” of (descendant folders of folder “\oracle”) of drives whose (type of it=“DRIVE_FIXED”)) )

http://support.bigfix.com/cgi-bin/inspectorsearch/single_inspector.cgi?cpx=c&keyphrase=conjunction+of+%26lt%3Bboolean%26gt%3B&type=boolean&win=&lin=&hpux=&mac=&aix=&sol=&wm=&ubu=&client=1&core=1