1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/mappings.sh Sat Jun 29 23:38:40 2013 +0200
1.3 @@ -0,0 +1,15 @@
1.4 +#!/bin/sh
1.5 +
1.6 +MAPPINGS=$*
1.7 +ID_MAPPING="mapping-id-to-page.txt"
1.8 +TINY_ID_MAPPING="mapping-tiny-to-id.txt"
1.9 +TINY_MAPPING="mapping-tiny-to-page.txt"
1.10 +TAB=`printf '\t'`
1.11 +
1.12 +# Combine the space mappings into a common mapping from page identifiers to
1.13 +# page names.
1.14 +sort -n -u $MAPPINGS > "$ID_MAPPING"
1.15 +
1.16 +# Produce a common mapping from tiny URL identifiers to page names.
1.17 +cut -f 1 "$ID_MAPPING" | uniq | python tiny.py - > "$TINY_ID_MAPPING"
1.18 +join -t "$TAB" -1 2 -2 1 "$TINY_ID_MAPPING" "$ID_MAPPING" | cut -f 2,3 | LC_ALL=C sort > "$TINY_MAPPING"