I am using the following complex command pipeline to find all files whose name ends in .xma or .sma, then find a certain string in them and sort the results. This is to find all files for a certain application on my system to see which versions I have used (important for upgrading, migrating).
find . -path ./Library/Mail -prune -or -path ./Documents/Architecture/BiZZdesign_Profiles \
-prune -or -name \*.\[sx\]ma \( -exec grep -H lastSavedWith {} \; \
-or -exec grep -H createdBy {} \; \) |\
sed -E 's/([^:]+).*(Architect|Enterprise Studio) ?([^<]+).*/\2 \3: \1/'|sort
This works well, and I get my list. But files created with really old versions of this application have no such string at all. Hence, I need to find any file that has a name ending in .xma or .sma, but without any of the strings 'lastSavedWith' or 'createdBy' in them. Is there a way to do that?