0
我已經嘗試了下面的代碼,但它正在逐行檢查並希望在整個文件中檢查它。請幫我在寫正確的代碼,一旦我得到的模式打破它和模式以極格局沒有找到我想在tcl中搜索整個文件中的模式[嚴重級別:嚴重]
set search "Severity Level: Critical"
set file [open "outputfile.txt" r]
while {[gets $file data] != -1} {
if {[string match *[string toupper $search]* [string toupper $data]] } {
puts "Found '$search' in the line '$data'"
} else {
puts "Not Found '$search' in the line '$data'"
}
}