I'm a c-shell guy so I am trying to learn powershell. I have the following file:
Environment: production
Servers : 3
Users : 25
Nodes : 20
Environment: alpha
Servers : 4
Users : 21
Nodes : 19
etc.
I want to check that if the first value on the left is "Environment" then I store in a variable the value on the right - "Production", then from there store each subsequent left/right pair until I hit the next "Environment" where I would store the next value.
I cannot make my regexp powershell work using ForEach-Object.
Import-Csv datafile.txt -Delimiter ':' -Header Key,Valueor just split the lines on the:character.