V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
longchisihai1
V2EX  ›  Linux

有什么好的方法查找指定目录下包含某个内容的文件吗?

  •  
  •   longchisihai1 · 2017-03-17 19:20:01 +08:00 · 1854 次点击
    这是一个创建于 2603 天前的主题,其中的信息可能已经有所发展或是发生改变。
    如题所示,此目录里面有非常多的子目录和文件,比如说我想遍历出文件内容有 aaa 的所有文件路径,有什么好的方法吗?
    3 条回复    2017-03-19 09:40:40 +08:00
    shiny
        1
    shiny  
       2017-03-17 19:21:14 +08:00
    grep -r "aaa" ./*
    knightdf
        2
    knightdf  
       2017-03-17 21:50:27 +08:00
    find /xxx/xx -type f |xargs grep -n "aaa"
    -n 输出行号
    ic3z
        3
    ic3z  
       2017-03-19 09:40:40 +08:00 via Android
    ag 命令
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2045 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 02:02 · PVG 10:02 · LAX 19:02 · JFK 22:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.