我想递归搜索我的Maven仓库(一个n文件夹深层的罐子),为一个未知的罐子里的特定类。bash命令:搜索文件系统的罐子里的类
jar -tvf myJar.jar | grep ClassIWant.class适用于已知的jar,但我遇到了管道/链接bash命令以实现递归搜索的问题。
任何提示非常赞赏。
相关:BASH :: find file in archive from command line
我想递归搜索我的Maven仓库(一个n文件夹深层的罐子),为一个未知的罐子里的特定类。bash命令:搜索文件系统的罐子里的类
jar -tvf myJar.jar | grep ClassIWant.class适用于已知的jar,但我遇到了管道/链接bash命令以实现递归搜索的问题。
任何提示非常赞赏。
相关:BASH :: find file in archive from command line
后已经存在。在这里解决Find a jar file given the class name?感谢您的选择。
击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.2。 – markdsievers 2010-10-15 03:00:11
然后使用find ..请参阅编辑 – ghostdog74 2010-10-15 03:00:49
find -name \*.jar | xargs -n1 -iFILE sh -c "jar tvf FILE | sed -e s#^#FILE:#g" | grep classIWant\\.class | cut -f1 -d:
对不起,忘了提及,我可能会得到一些作为脚本的东西,但理想情况下希望只有一个班轮。 – markdsievers 2010-10-15 02:52:27
发现同样的问题在这里回答http://stackoverflow.com/questions/1500141/find-a-jar-file-given-the-class-name – markdsievers 2010-10-15 03:08:22