我需要从多个report.html grep“status”并制作合并报告,这些报告保存在以下目录中。用**突出显示的所有目录对于每个报告都不同。我怎么能实现这一点。 C:\ Program Files(x86)\ Jenkins \ jobs ** E2E_Sanity ** \ jobs ** ABC_E2E_Sanity ** \ builds ** 41 ** \ archive \ performanceTestsReports ** pcRun106821 ** \ Report
答案 0 :(得分:0)
例如使用python和glob模块:
import glob
files = r"C:\Program Files (x86)\Jenkins\jobs*\jobs*\builds*\archive\performanceTestsReports*\Report"
l = glob.glob(files)
for f in l:
print (f)
答案 1 :(得分:0)
找一个可以的小型常规程序:
搜索单词 - 状态并提取信息
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
}
}
}
}