How to omit `find ` failed items in macOS?
Solution 1:
First, define a function that can filter out the lines you want omitted. I would suggest the function shown below.
filter() { grep -v -e "No such file or directory" -e "Permission denied" -e "Operation not permitted"; }
Second, use the filter as shown below.
find / -name mywork-process 2> >(filter)
Suggestion: To help prevent searching other mounted volumes, use the -x
option, as shown below.
find -x / -name mywork-process 2> >(filter)