Unix找到:多种文件类型 [英] Unix find: multiple file types

查看:118
本文介绍了Unix找到:多种文件类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用多种文件类型来运行find -name。
例如。

  find -name * .h,*。cpp 

这可能吗?

解决方案

  $查找。 -name'* .h'-o -name'* .cpp'

man 页面输入 man find ,然后输入 / OPERATORS 然后回车。
$ b $ 对于GNU find来说并不是必须的,而是在Unix中是必要的。在这两种情况下,引号都很重要,如果这些类型的文件出现在当前目录中,则将引起错误。



在某些系统(如Cygwin)中,括号是必要的,使包括扩展集:

  $ find。 \(-name'* .h'-o -name'* .cpp'\)


I want to run find -name with multiple file types. Eg.

 find -name *.h,*.cpp

Is this possible?

解决方案

$ find . -name '*.h' -o -name '*.cpp'

To find this information in the man page, type man find and the search for operators by typing /OPERATORS and hit enter.

The . isn't strictly necessary with GNU find, but is necessary in Unix. The quotes are important in either case, and leaving them out will cause errors if files of those types appear in the current directory.

On some systems (such as Cygwin), parentheses are necessary to make the set of extensions inclusive:

$ find . \( -name '*.h' -o -name '*.cpp' \)

这篇关于Unix找到:多种文件类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆