Remove variables that match from array


hi,

i have array of event log warning , stuff. want weed out ones dont care , array contains this:

epicp595.20130405.0919.12167448.o9gp.ertf: not find image '\\epicaux\letters$\geis-notagline_blk_50.jpg' specified blob server paths....
epicp595.20130405.0919.07152515.he0d.ertf: not find image '\\epicaux\letters$\geis-notagline_blk_50.jpg' specified blob server paths....
epicp595.20130405.0918.32272783.kfnh.ertf: not find image 'etximport-prod_rwb-10225542-49-55296.jpg' specified blob server paths....
epicp595.20130405.0918.31700059.8sbk.ertf: not find image 'etximport-prod_rwb-10225542-497-20150.jpg' specified blob server paths....

i remove whole line contains "geis-notagline_blk_50.jpg", trying

$test = $messages | where-object {$_ -notcontains "geis-notagline_blk_50.jpg"}  $test = $messages | where-object {$_ -notlike "*geis-notagline_blk_50.jpg*"}

but not luck..

any suggestions?

thanks

maybe like:

$test = @()  foreach ($message in $messages) {   if ($message -notlike "*geis-notagline_blk_50.jpg*")   {     $test += $message   } }  $test


if find post has answered question, please mark answer. if find post helpful in anyway, please click vote helpful.




Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Domain migration ERR3:7075 Failed to change domain affiliation, hr=8007054a This operation is only allowed for the Primary Domain Controller of the domain

How do a find data in one file, search for it in another file and if not found, write a custom message to another file