代码之家  ›  专栏  ›  技术社区  ›  markdsievers

bash命令:在jars文件系统中搜索类

  •  4
  • markdsievers  · 技术社区  · 14 年前

    我想递归地搜索我的maven存储库(一个n文件夹的jars的深层继承者),寻找一个未知jar中的特定类。

    任何暗示都非常感谢。

    相关: BASH :: find file in archive from command line

    3 回复  |  直到 8 年前
        1
  •  9
  •   gawi    14 年前
    find -name \*.jar | xargs -n1 -iFILE sh -c "jar tvf FILE | sed -e s#^#FILE:#g" | grep classIWant\\.class | cut -f1 -d:
    
        2
  •  3
  •   ghostdog74    14 年前

    猛击4+

    shopt -s globstar
    for file in **/*.jar
    do
      jar -tvf "$file" | grep ....
    done
    

    <4个++

    find /path -type f -name "*.jar" | while read -r FILE
    do
         jar -tvf "$FILE" | grep ....
    done
    
        3
  •  3
  •   Community CDub    8 年前

    帖子已经存在。在这里解决 Find a jar file given the class name? 谢谢你的选择。