15 lines
634 B
PowerShell
15 lines
634 B
PowerShell
# Gestione fix files di log in caso di errore di formattazione (separatore ora formattata con "." al posto di ":")
|
|
#
|
|
# ./RecorderLogFixer .ps1 nomefile_senza_virgole
|
|
|
|
# Get-Help about_regular_expressions
|
|
# https://www.itprotoday.com/powershell/replacing-strings-files-using-powershell
|
|
# https://regex101.com/
|
|
|
|
param([string] $file = "SOUR.log")
|
|
|
|
# leggo file
|
|
Get-Content $file |
|
|
# sostituisco 2 volte x i 2 item
|
|
ForEach-Object { $_ -replace "([\w|\W]+)T(\w+)[.](\w+)[.](\w+)[.](\w+)", '$1T$2:$3:$4.$5' } |
|
|
ForEach-Object { $_ -replace "([\w|\W]+)T(\w+)[.](\w+)[.](\w+)[.](\w+)", '$1T$2:$3:$4.$5' } | Out-file -encoding UTF8 fix_$file |