adde functions to allow unification of hashmap creation

This commit is contained in:
Karl-Wilfried Zimmer 2024-02-08 22:20:38 +01:00
parent 8f8da682d2
commit ef7e7b933b

View File

@ -65,9 +65,25 @@ foreach ($elem in $Elements){
$HashTable $HashTable
} }
$lines = Get-Content -Path .\log.txt | ForEach-Object {$_.SubString($_.IndexOf(":")+1)} function getElems {
param (
$Path
)
$lines = Get-Content -Path $Path | ForEach-Object {$_.SubString($_.IndexOf(":")+1)}
$elems = $lines | Out-String -Stream | Select-String -Pattern "VMware-Maschine" | Out-String -Stream
return $elems
}
function ProcessLogToHash {
param (
$Path
)
ProduceHashMap -Elements $(getElems -Path $Path)
}
<#$lines = Get-Content -Path .\log.txt | ForEach-Object {$_.SubString($_.IndexOf(":")+1)}
$elems = $lines | Out-String -Stream | Select-String -Pattern "VMware-Maschine" | Out-String -Stream $elems = $lines | Out-String -Stream | Select-String -Pattern "VMware-Maschine" | Out-String -Stream
ProduceHashMap($elems) ProduceHashMap($elems)#>
<#$HashTable =@{} <#$HashTable =@{}
foreach ($elem in $Elems){ foreach ($elem in $Elems){
$indexOfFirst = $elem.IndexOf(" ") $indexOfFirst = $elem.IndexOf(" ")