Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Новый участник


Сообщения: 5
Благодарности: 0

Профиль | Отправить PM | Цитировать


Спасибо большое. Вот еще реализация на PowerShell:
Код: Выделить весь код
$log = Get-Content log.txt 
$result = @()
for($i=0;$i -lt $log.count;$i++) {
	if($log[$i] -match "Output file opened at") {
		$index = @()
		$date = Get-Date ($log[$i] -replace "(Output file opened at\s+|\.)")
		$date = $date.Tostring("yyyy-MM-dd HH:mm:ss")
		while($log[$i] -notmatch "PMS> RESET CLASS GHLR /COUNT") {
			$i++
			if($log[$i] -match "Response from") {
				$index += $i
			}
		}
		for($x=0;$x -lt $index.count;$x++) {
			$GHLR = $log[$index[$x]] -replace "Response from\s+"
			$e = $index[$x+1]-1
			if(!$index[($x+1)]) {
				$e = $i-1
			}
			$log[($index[$x]+1)..$e] | Foreach {
				$str = $_ -replace ":"," | $GHLR | "
				$result += "{0} | GHLR |{1}" -f $date,$str.Trim()
			}
		}
	}
}	
$result | Out-File result.txt

Отправлено: 10:24, 05-09-2014 | #3