Mdfind and zgrep for outliner

I posted an example for searching and returning the lines containing a string in the Omnigraffle group, but it doesn’t work the same way for OmniOutliner.

mdfind -onlyin . kind:OmniOutliner Peter -0 | xargs -0 zgrep -rl “Peter” *.xml

this works, but only works on the old oo3 format. kind: OmniOutliner doesn’t find .ooutline files.

I tried specifying OmniOutliner4 and 5 but that returned nothing.

I tried:

mdfind -onlyin . *.ooutline Peter -0 | xargs -0 zgrep -rl “Peter” *.xml
hmm maybe a plain old Find would work better here…


mdfind -onlyin . kind: “OmniOutliner Document” Peter
/Users/michaelisbell/OmniPresence2/american rape.ooutline
/Users/michaelisbell/OmniPresence2/story points 3.ooutline
/Users/michaelisbell/OmniPresence2/bsnt-mapping-outline copy.ooutline
/Users/michaelisbell/OmniPresence2/bsnt-mapping-outline (conflict 3 from michaelisbell on michaels-MacBook-Pro-Early-2015).ooutline

this worked…and then probably just a grep

mdfind -onlyin . kind: “OmniOutliner Document” Peter -0 | xargs -0 zgrep -r “Peter” .

hmm this seems to get more than I wanted. … zgrep doesn’t seem to pick up the piped filenames in this case…hmm

some new findings

mdfind -onlyin . kind: “OmniOutliner 3” Peter -0 | xargs -0 zgrep -rl “Peter” *.xml

this worked perfectly on oo3 files

Specifying “OmniOutliner 3” as kind for mdfind returns both .oo3 and .ooutline files. “OmniOutliner Document” returns only .ooutline files.

zgrep “xml” *.ooutline

finds .ooutline files that contain xml files

find . -iname “*.ooutline” -print0

finds all .ooutline files

stay tuned…