I have a text file with this content:
SEGMENTS="worker01 worker02 worker03 worker04"
WORKER_SEGMENTS="worker01 worker02 worker03 worker04"
#SEGMENTS="worker01"
#WORKER_SEGMENTS="worker01"
I read this file from another powershell script and I want to to create an array of the WORKER_SEGMENTS values. I have gotten so far:
$workers = Get-Content $strPath"\worker\conf\segments.conf" | Where-Object {$_ -like "*WORKER_SEGMENTS*"}
Write-Host $workers
This yields:
PS Q:\mles\etl-i_test\rc> .\etl.ps1
WORKER_SEGMENTS="worker01 worker02 worker03 worker04" #WORKER_SEGMENTS="worker01"
I only need the worker01, worker02, worker03, worker04 from WORKER_SEGMENTS (without the leading #) as an array. How do I achieve this?