#!/bin/bash # TODO: the best sorting results are acheived when the field separator # precedes any valid package name character in ASCII order - # the lowest of which is ASCII 43 '+'; so # ASCII 33 ('!') serves this purpose quite well - # someday, we should re-write the tools to use '!' instead of ':' - # then the sort command alone would yeild the same results as this script # and the warning could be removed from 'check.sh' readonly CSV_CHAR=':' readonly SEP_CHAR='!' for blacklist in *.txt do if grep ${SEP_CHAR} ${blacklist} then echo "can not sort: '${blacklist}' - contains '${SEP_CHAR}' char" else echo "sorting: '${blacklist}'" cat ${blacklist} | tr "${CSV_CHAR}" "${SEP_CHAR}" | sort | uniq | tr "${SEP_CHAR}" "${CSV_CHAR}" > ${blacklist}.temp mv ${blacklist}.temp ${blacklist} fi done