开发者

In Unix,cmd to search a file recursively and retrieve the file instead of just the path of the file

In Unix, what is the single cmd that lets me search and locate a file recursively and then retrieve the file instead of just the pa开发者_运维问答th of the file?


What do you mean by retrieve?

You can simply use -exec argument to find.

$ find /path/to/search -type f -name '*.txt' -exec cat {} \;
$ find /path/to/search -type f -name 'pattern' -exec cp {} /path/to/new \;

The second one should work.


cat `find /wherever/you/want/to/start/from -name name_of_file`

Note those quotes are backquotes (`).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜