Created
December 1, 2017 18:05
-
-
Save bonobo78/09b2d33736413df1e3724484f7771cab to your computer and use it in GitHub Desktop.
This file contains 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
filter ColorPattern( [string]$Pattern, [ConsoleColor]$Color, [switch]$SimpleMatch ) { | |
if( $SimpleMatch ) { $Pattern = [regex]::Escape( $Pattern ) } | |
$split = $_ -split $Pattern | |
$found = [regex]::Matches( $_, $Pattern, 'IgnoreCase' ) | |
for( $i = 0; $i -lt $split.Count; ++$i ) { | |
Write-Host $split[$i] -NoNewline | |
Write-Host $found[$i] -NoNewline -ForegroundColor $Color | |
} | |
Write-Host | |
} | |
Select-String -Path 'Z:\PROJET\RM3\RC1\logRC1.txt' -Pattern '^ORA-' -Context 10,0 | ColorPattern 'ORA-\w*' 'Red' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment