Created
May 24, 2009 14:03
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# Copyright 2009 Gaute Hope <[email protected]> | |
# 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