You are not logged in.
Hello!
I would like to know how I can search with pacman only in the package names, without searching descriptions?
For example, searching for the rar package (pacman -Ss rar) gives me tons of results with hundreds of packages, where "library" occurs in the description.
I have already read the pacman manual page, but I couldn't find anything suitable.
Greets, Horst
Offline
find /var/abs -type d -name *rar*
Love, and do what thou wilt - St. Augustine of Hippo
Offline
You could pacman -Sl core extra community | grep rar.
[git] | [AURpkgs] | [arch-games]
Offline
How about:
pacman -Slq | grep <package>
Archi686 User | Old Screenshots | Old .Configs
Vi veri universum vivus vici.
Offline
Woops, yeah, I meant -Slq.
[git] | [AURpkgs] | [arch-games]
Offline
perl -e '$search = "rar";$output=`pacman -Ss $search`;while($output=~/^(\S.*?\Q$search\E.*?\n(?:\s.*\n)*)/mgi){print $1}'
This does the normal "pacman -Ss whatever" search, but then it checks that the search term is in the package name. Just replace "rar" in "$search = "rar" with whatever you want to search for.
I tried to make it work with grep using -P, but I still don't know how to make it case-insensitive then ("-i" doesn't seem to work with perl regexes). Here it is anyway though:
pacman -Ss rar | grep -P "^\S.*?rar(?:.*|\n)*?(?=\n\S)"
Aside from being case-sensitive, you also have to replace both instances of "rar" with your search term.
Here's a script version that you can run from the command line:
#!/usr/bin/perl
use strict;
use warnings;
my $search = "@ARGV";
my $output = '';
open(my $pipe,'-|',"pacman -Ss $search") or die "Unable to create pipe to pacman: $!\n";
while (defined(my $line=<$pipe>)){$output.=$line;}
close $pipe;
while($output=~/^(\S.*?\Q$search\E.*?\n(?:\s.*\n)*)/mgi){print $1};
Save it as "search_pkgnames", make it executable, then invoke it with your search term: search_pkgnames rar
Hope this helps.
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
You can even alias the above script to work with pacman, i.e. alias "pacman -Sp" /path/to/search_pkgnames.
Have you Syued today?
Free music for free people! | Earthlings
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery
Offline
You can even alias the above script to work with pacman, i.e. alias "pacman -Sp" /path/to/search_pkgnames.
I would suggest something other than "-Sp" as that's for printing the URIs... perhaps "pacman -Ss --by-name" instead.
Interesting idea btw... I hadn't even considered making aliases like that.
*walks off rubbing hands together at newfound power*
Last edited by Xyne (2008-09-04 20:36:57)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Oops, you're right, I had forgotten about the -p flag. How about pacman -Sss?
Have you Syued today?
Free music for free people! | Earthlings
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery
Offline