Package Manager Console search on Id only

If I enter this command...

Get-Package -ListAvailable -Filter newtonsoft

I get a listing of all packages that reference the string 'newtonsoft' in their Id or Description/Release Notes fields. Is there a way to search the Id field only?

Answers


You can use the Where-Object cmdlet to filter the results. The $_ represents the current object in the pipeline:

Get-Package -ListAvailable -Filter newtonsoft | Where {$_.<prop-name> -match '<regex>'}

Note that the -match operator matches the value of the specified property name to the specified regular expression. Specifically I think you want this:

Get-Package -ListAvailable -Filter newtonsoft | Where {$_.Id -match 'newtonsoft'}

Need Your Help

How to specify Exception when it doesn't seem to have a module?

ruby exception-handling

I've got some client code, in this example MyModule, that defines some custom Exceptions in a sub module called Exception. In MyModule there is a rescue block that references Exception. The problem...

Most efficient way of MySQL rows?

php mysql phpmyadmin full-text-search like

I know very little of MySQL. Right now I've a table with close to 1,000,000 entries and I wish to search for a particular string in a particular column and return the columns.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.