Hello,
I want to parse text and count different value.
My script looks like this:
cls $count = "" $value = "Test1yesnoTest2thatsitTest4" $value | select-string -Pattern "Test1" | "Test4" | foreach{$count = $count + 1} Write-Host $count
Now the result from $count should be 2, but i get an error:
Expressions are only allowed as the first element of a pipeline.
At C:\Users\y\AppData\Local\Temp\2\efcf8830-f70e-4b6f-86e7-d976fb361fbf.ps1:5 char:55
+ $value | select-string -Pattern ("Test1") | ("Test4") <<<< | foreach{$count = $count + 1}
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : ExpressionsMustBeFirstInPipeline
I want to parse the content with option or!
I hope somebody can help me,
Thanks Horst MOSS 2007 Farm; MOSS 2010 Farm; TFS 2010; IIS 7.5