Es posible especificar, en el contexto de los archivos de la búsqueda en mi MacOS Catalina 10.15.3, una forma de combinar en el mismo tiempo un potencial subcadena de nombre de archivo y el caso insensible de esta sub ?
Por el momento, sé que el comando :
1) mdfind -name 'substring'
para la subcadena
2) mdfind 'kMDItemFSName == substring
para insensible caso
Pero me pregunto si se puede combinar de ellos (como el clásico locate -i substring
de comandos).
ACTUALIZACIÓN 1 : no puedo explicar el mal funcionamiento de mi mdfind
comando comparación con el clásico comando locate
. De hecho, por ejemplo, con la clásica locate
comando, tengo un montón de archivos con subcadena *include.h*
haciendo :
$ locate include.h
/Applications/MATLAB_R2016b.app/help/bugfinder/ref/includeinclude.html
/Applications/MATLAB_R2016b.app/help/codeprover/ref/includeinclude.html
/Applications/MATLAB_R2016b.app/help/coder/ref/coder.cinclude.html
/Applications/MATLAB_R2016b.app/help/simulink/slref/coder.cinclude.html
/Applications/MATLAB_R2016b.app/polyspace/examples/cxx/Demo_C/sources/include.h
/Applications/MATLAB_R2016b.app/polyspace/examples/cxx/Demo_C_Single-File/sources/include.h
/Applications/MATLAB_R2016b.app/polyspace/examples/cxx/Demo_C_Workflow/sources/includes/include.h
/Applications/MATLAB_R2016b.app/polyspace/examples/cxx/Demo_Cpp/sources/include.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/usr/include/libxml2/libxml/xinclude.h
/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk/usr/include/libxml2/libxml/xinclude.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cffi/_cffi_include.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/gems/libxml-ruby-3.1.0/ext/libxml/ruby_xml_xinclude.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/apache2/mod_include.h
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2/libxml/xinclude.h
/Applications/Xcode.app/Contents/Developer/Platforms/WatchOS.platform/Developer/SDKs/WatchOS.sdk/usr/include/libxml2/libxml/xinclude.h
/Applications/Xcode.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator.sdk/usr/include/libxml2/libxml/xinclude.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2/libxml/xinclude.h
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/libxml2/libxml/xinclude.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0/gems/libxml-ruby-2.9.0/ext/libxml/ruby_xml_xinclude.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/apache2/mod_include.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include/libxml2/libxml/xinclude.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cffi/_cffi_include.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0/gems/libxml-ruby-3.1.0/ext/libxml/ruby_xml_xinclude.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/apache2/mod_include.h
/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/libxml2/libxml/xinclude.h
/Library/WebServer/share/httpd/manual/mod/mod_include.html
/Library/WebServer/share/httpd/manual/mod/mod_include.html.en
/Library/WebServer/share/httpd/manual/mod/mod_include.html.fr.utf8
/Library/WebServer/share/httpd/manual/mod/mod_include.html.ja.utf8
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cffi/_cffi_include.h
/System/Library/Templates/Data/Library/WebServer/share/httpd/manual/mod/mod_include.html
/System/Library/Templates/Data/Library/WebServer/share/httpd/manual/mod/mod_include.html.en
...
mientras que con el personal definida comando locate
definido por :
#!/bin/bash
if [ "$2" != "" ]; then
mdfind -name "$1" -onlyin "$2"
else
mdfind -name "$1"
fi
Entonces, si yo hago es : $ locate include.h
Puedo obtener un solo resultado :
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/cffi/_cffi_include.h
Lo mismo con : $ locate 'include.h'
¿Por qué muchos de los resultados que faltan usando mdfind
de comandos en lugar de la estándar locate
comando ? Parece que tengo que especificar la subcadena con una opción para mdfind
, pero no sé, por el momento esta opción.
Cualquier comentario o ayuda sería agradable.