bibi92
asked on
select-string and exclude
Hello,
I try to add exclude on this command, but it does not work :
$SPEC_DISK = @( Select-String $MONITORING_ENV -Pattern "^(.+):DISK:$" -exclude "^([A-Z]:\\.+):DISK:OFF"| ForEach-Object { $_.matches } | ForEach-Object { $_.groups[1].value } | Select -Unique)
How can I resolve it?
Thanks
I try to add exclude on this command, but it does not work :
$SPEC_DISK = @( Select-String $MONITORING_ENV -Pattern "^(.+):DISK:$" -exclude "^([A-Z]:\\.+):DISK:OFF"| ForEach-Object { $_.matches } | ForEach-Object { $_.groups[1].value } | Select -Unique)
How can I resolve it?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I have remove $
$SPEC_DISK = @( Select-String $MONITORING_ENV -Pattern "^(.+):DISK:" |? {$_ -notmatch "^([A-Z]:\\.+):DISK:OFF"} | ForEach-Object { $_.matches } | ForEach-Object { $_.groups[1].value } | Select -Unique)
Thanks
$SPEC_DISK = @( Select-String $MONITORING_ENV -Pattern "^(.+):DISK:" |? {$_ -notmatch "^([A-Z]:\\.+):DISK:OFF"} | ForEach-Object { $_.matches } | ForEach-Object { $_.groups[1].value } | Select -Unique)
Thanks
No result, $Monitoring_env is a txt file which containsBTB the the lines which you posted doesn't contain anything which is matching to the pattern in code..
z:\mssql:FS:20%:30%
z:\mssql\:FS:20%:30%
k:\mssql:FS:OFF
k:\mssql\:FS:OFF
Thanks
ASKER
Sorry, like I'm on several IT Operations, I don't note this.
ASKER
z:\mssql:FS:20%:30%
z:\mssql\:FS:20%:30%
k:\mssql:FS:OFF
k:\mssql\:FS:OFF
Thanks