1 2 3 4 5 6 7
#!/bin/sh while [ $# != 0 ]; do ( grep '^#' $1; grep -v '^#' $1 | LC_ALL=C sort ) > $1.tmp mv $1.tmp $1 shift done