Skip to content

Instantly share code, notes, and snippets.

@gauteh
Created May 24, 2009 14:03
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 gauteh/117111 to your computer and use it in GitHub Desktop.
Save gauteh/117111 to your computer and use it in GitHub Desktop.
Counts resulting categories for Exherbo repositories using the namingschemes; first two chars, last two chars and first and last char.
#! /bin/bash
# Copyright 2009 Gaute Hope <eg@gaute.vetsj.com>
# Distributed under the GNU General Public Licence v2
#
# Counts resulting categories for Exherbo repositories
# using the namingschemes; first two chars, last two chars
# and first and last char.
repos=$(paludis --list-repositories | tr -d '*\n')
for r in $repos; do
echo "${r}: "
paludis --compact --repository $r --list-packages | \
tr -d '* ' | \
egrep -v "(foundin:|^$)" | \
sed -e 's|.*/||' | sort > /tmp/packages
# number of packages
echo -n " * total: "
cat /tmp/packages | wc -l
# first two
echo -n " * first two: "
cut -c 1,2 /tmp/packages | sort -u | wc -l
# last two
echo -n " * last two: "
(for p in $(cat /tmp/packages | tr '\n' ' '); do
echo ${p:(-2)}
done) | sort -u | wc -l
# first and last
echo -n " * f & l: "
(for p in $(cat /tmp/packages | tr '\n' ' '); do
echo ${p:0:1}${p:(-1)}
done) | sort -u | wc -l
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment