V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
longchisihai1
V2EX  ›  Linux

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

  •  
  •   longchisihai1 · Mar 17, 2017 · 2497 views
    This topic created in 3342 days ago, the information mentioned may be changed or developed.
    如题所示,此目录里面有非常多的子目录和文件,比如说我想遍历出文件内容有 aaa 的所有文件路径,有什么好的方法吗?
    3 replies    2017-03-19 09:40:40 +08:00
    shiny
        1
    shiny  
    PRO
       Mar 17, 2017
    grep -r "aaa" ./*
    knightdf
        2
    knightdf  
       Mar 17, 2017
    find /xxx/xx -type f |xargs grep -n "aaa"
    -n 输出行号
    ic3z
        3
    ic3z  
       Mar 19, 2017 via Android
    ag 命令
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3261 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 13:58 · PVG 21:58 · LAX 06:58 · JFK 09:58
    ♥ Do have faith in what you're doing.