Skip to content

Instantly share code, notes, and snippets.

@przemoc
Created August 23, 2014 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save przemoc/a6a2bf05e112910be944 to your computer and use it in GitHub Desktop.
Save przemoc/a6a2bf05e112910be944 to your computer and use it in GitHub Desktop.
[Arch] List provisions with packages providing them
# [Arch] List provisions with packages providing them
# pacman-based solution
pacman -Si \
| awk '/^$/{n=""}/^Name/{n=$3}/^Provides/{if($3!="None"){for(i=3;i<=NF;i++){if(t[$i]=="")t[$i]="";t[$i]=t[$i]" "n}}}END{for(p in t)printf("%44-s :%s\n",p,t[p])}' \
| sort | less
# expac-based solution (better)
expac -S "%n %P" \
| awk 'NF>1{for(i=2;i<=NF;i++){if(t[$i]=="")t[$i]="";t[$i]=t[$i]" "$1}}END{for(p in t)printf("%44-s :%s\n",p,t[p])}' \
| sort | less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment