dnf search with regular expression query, sorted output?
Coming from Debian and being used to be able to search for packages like:
apt-cache search ^vim
And thus finding all packages that has a name that begins with vim, sorted by package name, is there any similar functionality available that I'm unable to find?
Right now I'm resorting to:
dnf search vim | sort | grep ^vim
..which feels a bit redundant.
Indeed it is; why are you using
sort
at all? I don't use dnf as yet, but I do know that this will work in yum:yum seaarch vim\*
and I see no reason it wouldn't work just as well with dnf.The output is not sorted here at least. An example of the above query, the first 6 packages start with the characters: v.., n.., g.., v.., n.., v.., where the expected order would be g.., n.., n.., v.., v.., v... Non-sorted output makes it harder to find what you're looking for, specially if you recall what an application name begins with.
I've noticed that "pkcon search" instead of "dnf search" returns the list sorted at least, but according to https://bugs.freedesktop.org/show_bug... at least pkcon still lacks regexp matches, and the ticket is from 2010 so it looks like a dead end... and I guess dnf doesn't support it either.
Using ^vim in your query only gets you packages that start with vim; how are you getting packages who's names start with other letters?
By not using grep, only dnf search, the problem was not that I couldn't find packages starting with "vim" in an ordered fashion, but that I had to compose the output via a number of commands, however, the marked answer below explains how dnf is supposed to be used.