Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Looking to search files for a string and then exclude lines with a different string

$
0
0

first part works ok. but i try adding where obj to filter the unwanted strings and it still includes them. Here im searching for lines with SERVER and trying to exclude lines with INC

get-childitem $folder -filter "*.lic"|foreach-object {select -Property name; Select-String "SERVER " $_.FullName|where-object {$_.Line -notcontains "INC"}} 

submitted by /u/vwpcs
[link] [comments]

The post Looking to search files for a string and then exclude lines with a different string appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles