1 #!/bin/sh 2 3 PROGNAME=`basename $0` 4 THISDIR=`dirname $0` 5 6 SPACES=$* 7 8 if [ ! "$SPACES" ]; then 9 echo "$PROGNAME <space directory>..." 10 exit 1 11 fi 12 13 ID_MAPPING="mapping-id-to-page.txt" 14 TINY_ID_MAPPING="mapping-tiny-to-id.txt" 15 TINY_MAPPING="mapping-tiny-to-page.txt" 16 TAB=`printf '\t'` 17 18 # Combine the space mappings into a common mapping from page identifiers to 19 # page names. 20 sort -n -u `find $SPACES -name MAPPING` > "$ID_MAPPING" 21 22 # Produce a common mapping from tiny URL identifiers to page names. 23 cut -f 1 "$ID_MAPPING" | uniq | "$THISDIR/tiny.py" - > "$TINY_ID_MAPPING" 24 join -t "$TAB" -1 2 -2 1 "$TINY_ID_MAPPING" "$ID_MAPPING" | cut -f 2,3 | LC_ALL=C sort > "$TINY_MAPPING"