summaryrefslogtreecommitdiff
path: root/src/categories
blob: 9261fdff9b9aba619d2310bf806e585d60a3d97c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
set -euo pipefail


usage() {
	echo 'Usage: categories DIRECTORY'
}

DIRECTORY="${1:-}"
eval "$(assert-arg -- "$DIRECTORY" 'DIRECTORY')"

listall() (
	cd "$DIRECTORY"
	find category.*.*.sortdata | cut -d. -f2 | sort | uniq
)

for category in `listall`; do
	out="$DIRECTORY"/categories."$category".sortdata
	cat "$DIRECTORY"/category."$category".*.sortdata > "$out"
	printf '%s\n' "$out"
done