首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如果我想打开这些文件,这里的后续部分是什么?

如果我想打开这些文件,这里的后续部分是什么?
EN

Stack Overflow用户
提问于 2019-09-23 10:56:34
回答 2查看 56关注 0票数 2

需要添加什么才能打开找到的所有文件?

查找。-iname '04*x‘

EN

回答 2

Stack Overflow用户

发布于 2019-09-23 11:49:37

-exec标志用于提供必须对使用find命令找到的文件执行的命令。

从手册上看-

代码语言:javascript
运行
复制
 -exec utility [argument ...] ;
         True if the program named utility returns a zero value as its exit status.  Optional arguments may be passed to the utility.  The expression must be terminated by a semicolon (``;'').  If you invoke
         find from a shell you may need to quote the semicolon if the shell would otherwise treat it as a control operator.  If the string ``{}'' appears anywhere in the utility name or the arguments it is
         replaced by the pathname of the current file.  Utility will be executed from the directory from which find was executed.  Utility and arguments are not subject to the further expansion of shell pat-
         terns and constructs.

下面我使用vi编辑器打开找到的文件-

代码语言:javascript
运行
复制
find . -iname '04*x' -exec vi {} \;
票数 1
EN

Stack Overflow用户

发布于 2019-09-23 11:33:29

您可以使用以下命令打开通过find命令找到的文件:

代码语言:javascript
运行
复制
find . -iname "filename" -exec cat {} \;
find . -iname "filename" | xargs cat

第一个命令是使用-exec,它将向cat命令提供输出,以打开文件并在终端上显示它。{}表示find命令的输出。

第二个命令是使用xargs,它将提供outout to cat命令来打开文件,就像在第一个选项中一样。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/58055119

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档