Skip to content

Instantly share code, notes, and snippets.

@hansgafriedzal
Created December 15, 2023 08:53
Show Gist options
  • Save hansgafriedzal/c47e72a292431f94809ebf31dbf3dfc5 to your computer and use it in GitHub Desktop.
Save hansgafriedzal/c47e72a292431f94809ebf31dbf3dfc5 to your computer and use it in GitHub Desktop.
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