summaryrefslogtreecommitdiff
path: root/sort-entries
diff options
context:
space:
mode:
Diffstat (limited to 'sort-entries')
-rwxr-xr-xsort-entries22
1 files changed, 22 insertions, 0 deletions
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