NetBSD/distrib/sets/sort-list

15 lines
220 B
Bash
Executable File

#!/bin/sh
set -eu
die() {
echo "$*" 1>&2
exit 1
}
for fname; do
{ grep '^#' "$fname" || die "Missing comment line in $fname"
grep -v '^#' "$fname" | LC_ALL=C sort
} > "$fname.tmp"
mv "$fname.tmp" "$fname"
done