On 04/18/12 12:57, Philip Brown wrote:
I think it used to be that "pkg search sstring" would search filenames
only, and there was no way to search by description.
I found a web archive that claims that functionality was "coming".
However, now, in the latest solaris 11,
(VM image of 11/11) it seems that the default is to search filename and
description.
Sadly, this "enhancement" is the exact opposite of what I want. But
reading the voluminous manpage, does not seem to say how, or even if, it
is possible to search only by filename any more?
As long as I can remember, search has always treated searches such as
'pkg search foo' as not being specific to a filename. That is, it will
match anything it can, including descriptions or filenames.
If you want to limit your search to filesystem names (directories and
files), you have two options, either start the pattern with a leading
'/' and include the full path to the item you're searching for or use
the advanced search syntax to limit matches to 'path' or 'basename':
$ pkg search -o path,pkg.name -l /usr/bin/vim
PATH PKG.NAME
usr/bin/vim editor/vim/vim-core
$ pkg search -o path,pkg.name -l :path:*/vim
PATH PKG.NAME
usr/bin/vim editor/vim/vim-core
usr/demo/mercurial/vim developer/versioning/mercurial
usr/share/vim editor/vim
usr/share/vim editor/vim/vim-core
$ pkg search -o path,pkg.name -l :basename:vim
PATH PKG.NAME
usr/bin/vim editor/vim/vim-core
usr/demo/mercurial/vim developer/versioning/mercurial
usr/share/vim editor/vim
usr/share/vim editor/vim/vim-core
If you wanted to limit the search to just 'files', then you could also
specify the action type 'file':
$ pkg search -o path,pkg.name -l :file:basename:vim
PATH PKG.NAME
usr/bin/vim editor/vim/vim-core
Example 7 in the current version of pkg(1) hints at this, as well as the
following usage text under 'search':
Boolean search using AND and OR is supported. Field, or
structured, queries are supported. The syntax for these
is pkg_name:action_type:key:token. Missing fields are
implicitly wildcarded. A search for :basename:pkg
matches all action types in all packages with a key of
basename and that match the token pkg. Explicit wild-
cards are supported in the pkg_name and token fields.
The action_type and key must match exactly.
-Shawn
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss