You are not logged in.

#1 2018-09-16 02:06:34

davy_crockett
Member
Registered: 2015-10-21
Posts: 75

[SOLVED] grep help - list all non-installed packages with descriptions

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

#2 2018-09-16 02:26:10

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,520
Website

Re: [SOLVED] grep help - list all non-installed packages with descriptions

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

#3 2018-09-16 04:06:52

davy_crockett
Member
Registered: 2015-10-21
Posts: 75

Re: [SOLVED] grep help - list all non-installed packages with descriptions

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

#4 2018-09-16 04:29:30

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,520
Website

Re: [SOLVED] grep help - list all non-installed packages with descriptions

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

#5 2018-09-16 04:39:33

davy_crockett
Member
Registered: 2015-10-21
Posts: 75

Re: [SOLVED] grep help - list all non-installed packages with descriptions

No it doesn't; try it smile

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 smile

Offline

#6 2018-09-16 14:44:37

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,520
Website

Re: [SOLVED] grep help - list all non-installed packages with descriptions

Ah, you're right.  Sorry.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

Board footer

Powered by FluxBB