Created
December 15, 2023 08:53
-
-
Save hansgafriedzal/c47e72a292431f94809ebf31dbf3dfc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd '' | |
$noOfSubsequentLines = 10 | |
dir -File -Recurse | where Extension -eq .log | foreach { | |
Write-Progress $_.BaseName | |
$lineCounter = 0 | |
cat $_ | foreach { | |
$line = $null | |
$line = $_ | sls '1c8a58ca-ad9f-46e9-b307-92134222e03e' | |
if ($line.Count -gt 0) { | |
Write-Host | |
$line.Line | |
$lineCounter = $noOfSubsequentLines | |
} | |
elseif ($lineCounter -gt 0) { | |
$lineCounter-- | |
write-host " $($noOfSubsequentLines - $lineCounter) " -NoNewline -ForegroundColor green | |
$_.Trim() | |
} | |
} | |
} | |
Write-Progress -Completed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment