#!/bin/bash

ls -1 *gif | sed "s/-.*//g" | sort -u | while read i; do
	LIST=`ls -1 *gif | grep $i | sort -r`

	convert $LIST -append $i.gif
done

rm nwb.gif
LIST=`ls -1 *gif | grep -v -- "-"`
convert $LIST +append nwb.gif
