count.sh 203 Bytes
#!/bin/bash

if [ $# -lt 2 ]
then
  echo 'Please provide an input and an output file.'
  exit 1
fi

export LC_COLLATE=C
cat "$1" | sort | uniq --count | sed -E 's/( )*([0-9]+) (.*)/\3        \2/' > "$2"