[string] $s = "20015-10-01 12:00:53.986 War 8 [R: 33] [Ex][Type:Apiion][Err:30][HTTPStatus:NotFound][Message:text: 4950][CorrId:d1ce7555f63803a2]" [string] $s2 = "20015-10-01 13:00:53.986 War 8 [R: 33] [Ex][Type:Apiion][Err:33][HTTPStatus:Found][Message:text: 4930][CorrId:d333333333333a2]" # предположим, что это массив твоих строк из файла [array] $loglines = @($s, $s2) # для примера возьмум 2 $List = New-Object System.Collections.ArrayList # идем по массиву $loglines | ForEach-Object { $arr = $_.split("\[*\]") $Hash = [ordered]@{ # это название столбца = значение # $_ - это одна строка из лога Description = $arr[0] ID = $arr[1] Time = $arr[0] Status = $arr[9] URL = "http://" Message = $arr[11] CorrId = $arr[13] } [void]$List.Add(( [pscustomobject]$Hash )) } $List | Out-GridView -Title 'My Logs'
conclusion:
PS> $List Description : 20015-10-01 12:00:53.986 War 8 ID : R: 33 Time : 20015-10-01 12:00:53.986 War 8 Status : HTTPStatus:NotFound URL : http:// Message : Message:text: 4950 CorrId : CorrId:d1ce7555f63803a2 Description : 20015-10-01 13:00:53.986 War 8 ID : R: 33 Time : 20015-10-01 13:00:53.986 War 8 Status : HTTPStatus:Found URL : http:// Message : Message:text: 4930 CorrId : CorrId:d333333333333a2 PS > $List[0] | select -Property ID, Time, Status, URL ID Time Status URL -- ---- ------ --- R: 33 20015-10-01 12:00:53.986 War 8 HTTPStatus:NotFound http://
or so
PS > $List[0] | Format-Table Description ID Time Status URL Message CorrId ----------- -- ---- ------ --- ------- ------ 20015-10-01 12:00:53.986 War 8 R: 33 20015-10-01 12:00:53.986 War 8 HTTPStatus:NotFound http:// Message:text: 4950 CorrId:d1ce7555f63803a2
beautiful conclusion:

the rest depends on the implementation, but the principle is