I´m getting started with powershell and my knowledge is very poor right now. I have this .log file which looks like the following:
18.7.2017 12:59:15 Starting thread: KEYWORD1
18.7.2017 12:59:33 Thread finished; ... KEYWORD1
18.7.2017 13:32:19 Starting thread: KEYWORD2
18.7.2017 13:34:8 Thread finished;... KEYWORD2
I want to find out now, if every thread that started, has also been finished. If there is an unfinished thread I want to compare the timestamp with the current time.
I thought a hashtable would do the trick and that is what i came up with:
foreach($line in Get-Content $sourceDirectory)
{
if($line -like "*Starting thread*")
{
$arrStart = $line -split ' '
$startThreads=$arrStart[$arrStart.Length-1]
$hashmap1 = @{$arrEnd[$arrEnd.Length-1] = $arrEnd[1]}
}
if($line -like "*Thread finished*")
{
$arrEnd = $line -split ' '
$hashmap2 = @{$arrEnd[$arrEnd.Length-1] = $arrEnd[1]}
$endThreads=($arrEnd[1]+" "+$arrEnd[$arrEnd.Length-1])
}
}
How is it possible to compare these two hashmaps now?