You are not logged in.

#1 2014-10-21 09:16:55

akrep55tr
Member
Registered: 2013-11-20
Posts: 10

How to filter installed packages in Pacman -Ss

I want to search a package in the repos but I don't want to see installed packages, I want to see only uninstalled packages. Is it possible? It is not very important or urgent, but I want to know if it is possible.

Offline

#2 2014-10-21 10:25:38

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

Re: How to filter installed packages in Pacman -Ss

I don't know of any way to do this with a single pacman command, but the following would do:

comm -23 <(pacman -Ssq $serch_term) <(pacman -Qsq $search_term)

EDIT: Progandy's approach below seems much better to me.

Last edited by Trilby (2014-10-21 11:05:20)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2014-10-21 10:40:13

progandy
Member
Registered: 2012-05-17
Posts: 5,317

Re: How to filter installed packages in Pacman -Ss

If you want the descriptions, too then you can use a sed pattern to filter packages which are marked with [installed].

LANG=en_XX@POSIX pacman --color=always -Ss $search_term | sed '/\S.*\[installed\]/,/^\s/d'

Last edited by progandy (2014-10-21 10:41:13)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |

Offline

#4 2014-10-21 16:57:02

akrep55tr
Member
Registered: 2013-11-20
Posts: 10

Re: How to filter installed packages in Pacman -Ss

@Trilby, @ progandy
Thank you for your posts.


@progandy
I wrote a simple bash function with your answer, now I have what I want. Thank you again.

pacmanSs ()
{

      if [ -z "$1" ] ; then      
            echo "Write something to search..."   
      else
            pacman --color=always -Ss $1 | sed '/\S.*\[installed\]/,/^\s/d'
      fi
}

Offline

Board footer

Powered by FluxBB