#!/bin/sh

LC_CTYPE=C

i=1

if (test "$1" = "") || (test "$2" = ""); then
  echo "Usage: reorder [file_to_reorder] [reordering_of_file]"
  exit
fi

while test $[$i<15] = "1"
do
  i=$[$i+1]
  echo "Creating words.$i"
  cat $1 | lengsplit $i | sort > words.$i
done

echo "Assembling everything together in $2"

cat words.2 words.3 words.4 words.5 words.6 words.7 words.8 \
    words.9 words.10 words.11 words.12 words.13 words.14 words.15 \
    | eliminate > $2
