1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 22:40:12 +01:00
fdroidserver/tools/categorycount
2013-09-18 00:11:35 +02:00

31 lines
622 B
Bash
Executable File

#!/bin/bash
# Sorts categories by number of apps in them, discards disabled apps
declare -A count
for file in metadata/*.txt
do
while read line
do
[[ "$line" == "Disabled:"* ]] && break
if [[ "$line" == "Category:"* ]]
then
while IFS=';' read -ra categ
do
count[$categ]=$(( ${count[$categ]} + 1 )) || count[$categ]=1
done <<< "${line:9}"
break
fi
done < $file
done
output=""
for category in "${!count[@]}"
do
output+="${count[$category]}_$category\n"
done
echo -en "$output" | column -t -s '_' | sort -n