Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

Get filename that does not contain the specified string

$
0
0

I'm looking thru a group of files in a particular directory for a specified string, but I need to get the file names that do NOT contain the string.  This will get me a TRUE / FALSE, but without the filename:

ls . -name INCREMENTAL* | foreach {select-string -path $_ -pattern "->OR_CASE`:" -Quiet}

This one gets me the filenames that contain the string:

ls . -name INCREMENTAL* | foreach {select-string -path $_ -pattern "->OR_CASE`:" | format-table -property filename}

Is there a way to combine both?  "format-table -property filename, equals" did not work, as there's no value for the equals member or no value for the filename member if i use -Quiet in the 'sls' cmdlet.


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>