Mac OS X 10.6 plist string search

(imported topic written by SystemAdmin)

On Mac OS X 10.6, I need a True\False response using either a Fixlet, Task, or Analysis that tells me if a certain string exists, lets say: a.b.c.d in this file: /Library/Preferences/DirectoryService/DSLDAPv3PlugInConfig.plist

I don’t know the Mac OS, so I was given the code shown below, but I am not sure how to use it to get the True\False answer I need.

  1. cat /Library/Preferences/DirectoryService/DSLDAPv3PlugInConfig.plist | grep a.b.c.d

Any ideas?

(imported comment written by NoahSalzman)

There are a number of ways to do this. One way is to write a Relevance query that returns true/false. Here is how I test to see if a file contains a string I’m interested in:

Q: lines whose (it contains “Bluetooth DUN”) of file “/Library/Preferences/SystemConfiguration/preferences.plist”

A: %09%09%09%09Bluetooth DUN

A: %09%09%09Bluetooth DUN

I can then test a true/false statement:

Q: exists lines whose (it contains “Bluetooth DUN”) of file “/Library/Preferences/SystemConfiguration/preferences.plist”

A: True

It gets a little more complicated if you want to “walk” the plist file as if it were xml, like this:

https://www.ibm.com/developerworks/forums/thread.jspa?messageID=14757152&#14757152

Lastly, you can also do it in two steps where you have one Fixlet that writes out a value to a temp file and a separate Fixlet that reads in the resulting value or returns true/false based on reading that value.