regex to find font class

So, I need to find the instances of a certain font and remove it....so far in my testing I am using the find command with regex to find a font I want to pull out. However, I seem to be slightly stuck, and I am sure the beard stroking Unix geniuses here can help me.

My example code:

find -x -E /* -iregex .*\.arial -print
/Applications/Microsoft Office 2004/Office/Fonts/Arial
/Users/tlarkin/Library/Fonts/Arial
bash-3.2$ 

This does in fact find Arial, but it doesn't find every class of Arial, like black narrow, etc. I cannot wrap my head around using the string Arial to pull out every instance of Arial....

Thanks in advance for any help. I am running tons and tons of Macs here, so everything is OS X.

Doesn't this work instead of using a regexp?

find -x -E /* -iname "*arial*" -type f -print
1 Like

That does seem to work....maybe I was just on the wrong track trying to use a regular expression?

Thanks for that

#edit

Seems it also finds a ton of stuff I don't want or that exactly matches arial....still looking into a more specific solution

Unfortunately I don't have a Mac OS at hand, but what "ton of stuff" is it finding?

Looks like anything involved with fonts in every directory. Here is just a snip of the output:

bash-3.2$ find -x -E /* -iname "*arial*" -type f -print
/Applications/Microsoft Office 2004/Office/Fonts/Arial
/Applications/Microsoft Office 2004/Office/Fonts/Arial Black
/Applications/Microsoft Office 2004/Office/Fonts/Arial Narrow
/Applications/Microsoft Office 2004/Office/Fonts/Arial Rounded Bold
find: /Library/Application Support/Apple/ParentalControls/Users: Permission denied
find: /Library/Application Support/Apple/Remote Desktop/Client: Permission denied
find: /Library/Application Support/Apple/Remote Desktop/Task Server: Permission denied
find: /Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/.Spotlight-V100: Permission denied
find: /Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Application Support/Apple/ParentalControls/Users: Permission denied
find: /Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Application Support/Apple/Remote Desktop/Client: Permission denied
find: /Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Application Support/JAMF/Downloads: Permission denied
find: /Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Application Support/JAMF/Usage: Permission denied
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial Black.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial Bold Italic.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial Bold.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial Italic.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial Narrow Bold Italic.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial Narrow Bold.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial Narrow Italic.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial Narrow.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial Rounded Bold.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial Unicode.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/Arial.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/ArialHB.ttf
/Library/Application Support/JAMF/Composer/Sources/netboot/ROOT/Library/Fonts/ArialHBBold.ttf
^Z
[19]+  Stopped                 find -x -E /* -iname "*arial*" -type f -print
bash-3.2$ 

Like look at the parental controls....not sure why it is picking that up.

Those are errors about find not having access to read those directories - pipe stderr to dev null

Also you could limit to only .ttf and .fon files:

find -x -E /* -iregex ".*arial.*\(.ttf\|.fon\)$" -type f 2> /dev/null

Like this?

find -x -E /* -iname "*arial*" -type f -print 2>/dev/null

awesome guys I will try this tomorrow when I get back to work, thanks for the help.