如何用shell命令一次将查找的文件打开?

zhengzhe_nb_zj_cn 2003-09-09 05:59:49
也就是有两个动作:
1)查找所需文件
2)将找到的文件打开,(显示也行)
用一条shell语句实现!
...全文
114 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
zhengzhe_nb_zj_cn 2003-09-17
  • 打赏
  • 举报
回复
I see ,thank you!
wti 2003-09-12
  • 打赏
  • 举报
回复
cat `find ./ -name "*.c" -print`

find ./ -name "*.c" will find all of the file ended with .c,
and the option -print let the find output the full file name, which it finded.
(e.g. ./work/hello.c)
After the command find, the result will pass to cat.
So the cat can show all content of the found file^
zhengzhe_nb_zj_cn 2003-09-12
  • 打赏
  • 举报
回复
chinajiyun和sunsys的命令我怎么试不出来?请再指点一二!
zhengzhe_nb_zj_cn 2003-09-10
  • 打赏
  • 举报
回复
~是什么意思? find 后为什么还要加.
Piero 2003-09-10
  • 打赏
  • 举报
回复
一般来说,
具体的字符串 双引号 "helloworld"
含有通配符的字符串 单引号 'hell?worl?'
sunsys 2003-09-10
  • 打赏
  • 举报
回复
find / -name "*.c" -print -exec cat { } \

有点忘了字符串是 打 单引号/双引号/不打引号?!
'字符串'/"字符串"/字符串?!
chinajiyun 2003-09-09
  • 打赏
  • 举报
回复
或者
cat `find ./ -name "*.c" -print`

注意: ` 即键盘左上角的~
aria 2003-09-09
  • 打赏
  • 举报
回复
find . -name "*.c" | xargs cat
或者是
find . -name "*.c" | while read f; do cat $f; done

23,125

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧