diff options
Diffstat (limited to 'src/categories')
| -rwxr-xr-x | src/categories | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/categories b/src/categories new file mode 100755 index 0000000..a054069 --- /dev/null +++ b/src/categories @@ -0,0 +1,20 @@ +#!/bin/sh +set -euo pipefail + + +usage() { + echo 'Usage: categories DIRECTORY' +} + +DIRECTORY="${1:-}" +eval "$(assert-arg -- "$DIRECTORY" 'DIRECTORY')" + +listall() { + find "$DIRECTORY"/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 |
