Java 循环浏览多个目录并读取html文件以了解状态

Java 循环浏览多个目录并读取html文件以了解状态,java,jenkins,ant,Java,Jenkins,Ant,我需要从multiple report.html grep“status”并生成一个组合报告,这些报告保存在下面的目录中。对于每个报告,用**突出显示的所有目录都是不同的。我怎样才能做到这一点。 C:\Program Files(x86)\Jenkins\jobs**E2E\u Sanity**\jobs**ABC\u E2E\u Sanity**\builds**41**\archive\PerformanceTestReports**pcRun106821**\Report例如,使用pyth

我需要从multiple report.html grep“status”并生成一个组合报告,这些报告保存在下面的目录中。对于每个报告,用**突出显示的所有目录都是不同的。我怎样才能做到这一点。
C:\Program Files(x86)\Jenkins\jobs**E2E\u Sanity**\jobs**ABC\u E2E\u Sanity**\builds**41**\archive\PerformanceTestReports**pcRun106821**\Report

例如,使用python和模块:


找到一个小的groovy程序,它可以:

  • 提取固定行编号(如果状态为固定行)
  • 搜索单词-状态并提取信息

    int lineNo = 1
    //if the row number is fixed you can extracted by minLine and maxLine
    int minLine = 1
    int maxLine = 20
    def line
    def status
    def statusRegex
    
    
    def folder = new File("C:\\Users\\user\\Desktop\\ero")
    
    folder.eachFile{it->
    println "File: ${it.absolutePath}"
    
    it.withReader { reader->
        while ((line = reader.readLine()) != null & lineNo <= maxLine) {
    
            if (lineNo >= minLine) {
                //        println "${lineNo}. ${line}" //if you need specific line numbers
            }
            lineNo++
            //search for status and print the line
            status = line.find("status")
            //search for status by regex and extract all up to <
            statusRegex = line.find(/(?s)status (.*?)\</)
    
            if(status){
                println '    full line' + line
            }
            if(statusRegex){
                println '    by regex' + statusRegex
            }
        }
    }
    }
    
    int-lineNo=1
    //如果行号是固定的,则可以通过minLine和maxLine提取
    int minLine=1
    int maxLine=20
    def管路
    def状态
    def statusRegex
    def文件夹=新文件(“C:\\Users\\user\\Desktop\\ero”)
    folder.eachFile{it->
    println“文件:${it.absolutePath}”
    it.withReader{reader->
    而((line=reader.readLine())!=null&lineNo=minLine){
    //println“${lineNo}.${line}”//如果需要特定行号
    }
    lineNo++
    //搜索状态并打印行
    状态=行。查找(“状态”)
    //按正则表达式搜索状态,并提取所有到<
    
    statusRegex=line.find(/(?s)status(.*)\带有for循环?能否提供有关当前实现的更多详细信息?Python Java Groovy…选择一个
    int lineNo = 1
    //if the row number is fixed you can extracted by minLine and maxLine
    int minLine = 1
    int maxLine = 20
    def line
    def status
    def statusRegex
    
    
    def folder = new File("C:\\Users\\user\\Desktop\\ero")
    
    folder.eachFile{it->
    println "File: ${it.absolutePath}"
    
    it.withReader { reader->
        while ((line = reader.readLine()) != null & lineNo <= maxLine) {
    
            if (lineNo >= minLine) {
                //        println "${lineNo}. ${line}" //if you need specific line numbers
            }
            lineNo++
            //search for status and print the line
            status = line.find("status")
            //search for status by regex and extract all up to <
            statusRegex = line.find(/(?s)status (.*?)\</)
    
            if(status){
                println '    full line' + line
            }
            if(statusRegex){
                println '    by regex' + statusRegex
            }
        }
    }
    }