From b31e025f25e4dfe20e6d4d0ee88a267cf2167264 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Sun, 10 Feb 2019 22:37:12 -0500 Subject: add 'sort-entries' script and non-uniform sort warning to 'check.sh' --- sort-entries | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 sort-entries (limited to 'sort-entries') diff --git a/sort-entries b/sort-entries new file mode 100755 index 0000000..f688029 --- /dev/null +++ b/sort-entries @@ -0,0 +1,22 @@ +#!/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 -- cgit v1.2.2