Hm, when I run that version with sorting in the extract.txt I get error
ERROR : array reference out of bounds!
My out.txt has format like this:
DOMAIN\admin,,6/16/2004,16:15:18
What's wrong?