You are not logged in.
Cadged this from someone else and tweaked it a bit.
#!/bin/bash
# ~/bin/searchrepo.sh
cd /var/lib/apt/lists/
cat *$1* | grep "^Package: " | sed 's/^Package: //' | sort -uUsage - "searchrepo.sh string"
Example - "searchrepo.sh multimedia" - prints all packages contained in repos with string "multimedia" in their name.
Useful with output piped thru grep to search for specific packages.
Last edited by spoovy (2011-01-24 01:10:50)
Offline
Is this better than using Synaptic or apt-cache to search for packages?
Note: ** Please read before posting **
BTW if you wish to contact me, send me an e-mail instead of a PM.
Offline
I never found a way with aptitude, so I use this. There might be a way with apt-cache i dunno i never thought to look to be honest. Never use synaptic.
Is there a way with apt-cache?
Last edited by spoovy (2011-01-24 00:34:37)
Offline
I don't think you need the sudo for searching.
Note: ** Please read before posting **
BTW if you wish to contact me, send me an e-mail instead of a PM.
Offline
sudo apt-cache search multimedia
That just searches for packages containing the string "multimedia", in all enabled repos. As in, it returns packages from all enabled repos.
My script returns only results from the specified repo.
Last edited by spoovy (2011-01-24 00:47:32)
Offline
@spoovy - using your script how or where would you specify the repo you wanted to search?
Note: ** Please read before posting **
BTW if you wish to contact me, send me an e-mail instead of a PM.
Offline
It's explained in the OP. The example searches the debian multimedia repo, as it's the only repo in my sources.list with "multimedia" in the title.
You could use it to search any repo by specifying any string unique to that repo. I run debian with the statler repo added post install, so I also use it to see what's available in the statler repo with "searchrepo.sh statler".
Offline
Ok I understand now. For some reason I was thinking the string was the package name not repo name.
Note: ** Please read before posting **
BTW if you wish to contact me, send me an e-mail instead of a PM.
Offline
I tried to get it to work passing a second argument to grep but I haven't figured it yet. Any ideas?
It would need to return all results in the absence of a second argument, or only those results matching the second argument if one is present.
| grep "$2" doesn't work.
Offline
Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.