You are not logged in.
Hi there,
I'm after some help with grep/egrep. I want to list all non-installed packages in pacman with their descriptions so I can find out whether I want to install them. This page https://unix.stackexchange.com/question … arch-linux will list all non-installed packages, although doesn't have their descriptions. If I pipe the result back into pacman -Ss I still see installed packages in my listing.
Last edited by davy_crockett (2018-09-16 04:07:31)
Offline
Why do you assume this is a task for grep?
# in bash
comm -23 <(expac -S "%n: %d") <(expac -Q "%n: %d")
# in sh
expac -S "%n: %d" | sort >| /tmp/desc
expac -Q "%n: %d" | sort | comm -23 /tmp/desc -
EDIT: that stackexchange answer is really silly. The whole pipeline in the subshell on the first line could be replaced just by `pacman -Qq`, and in fact, that whole script should just be `comm -23 <(pacman -Ssq) <(pacman -Qq)`.
Last edited by Trilby (2018-09-16 02:33:29)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
I actually worked it out in the meantime like this (for each repository)
pacman -Ss | egrep -v '\[installed\]' | egrep -A1 '^core.*' | less
pacman -Ss | egrep -v '\[installed\]' | egrep -A1 '^extra.*' | less
pacman -Ss | egrep -v '\[installed\]' | egrep -A1 '^community.*' | less
Offline
Except that keeps the descriptions of installed packages tacked on to the description of whichever non-installed package was right before them.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
No it doesn't; try it
The first egrep selects all lines that doesn't have the [installed]; the second egrep makes sure the line begins with core, extra or community, which excludes the descriptions of the installed packages
Offline
Ah, you're right. Sorry.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline