Пример:
# example input array; you can replace this with Get-Content
# to read from a file, etc.
$inputData = @(
"RM_2123_0015_15728657.log:***** SQL Statement Prepare Time 0.000 seconds *****"
"RM_1213_0015_15728657.log:***** SQL Statement Execute Time 0.002 seconds *****"
"RM_1231_0015_15728657.log:***** SQL Statement Initial Fetch 0.001 seconds *****"
"RM_1212_0015_15728657.log:***** SQL Statement Prepare Time 0.000 seconds *****"
"RM_1111_0015_15728657.log:***** SQL Statement Execute Time 7.002 seconds *****"
"RM_1232_0015_15728657.log:***** SQL Statement Initial Fetch Time 10.001 seconds *****"
)
$inputData | Select-String '\d+\.\d{3}' | ForEach-Object {
$result = $_.Matches[0].Groups[0].Value
if ( $result -as [Int] -gt 5 ) {
$result
}
}
Добавить что-то вроде | Out-File Results.txt
после последнего }
, чтобы записать выходные данные в файл.