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 (`).
精彩评论