From 6c37038256d56eba58b4cc1fae4065c68a13dea7 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Sat, 17 Aug 2024 16:07:45 -0700 Subject: [PATCH] use uniq with LC_ALL=C We make sure that when we uniq, we sort with `LC_ALL=C` as in: > LC_ALL=C uniq ... Changed `bin/csv2entry.sh` VERSION from "1.2.1 2024-08-17" to "1.2.2 2024-08-17". Performed `make csv2entry` to test the above under macOS. --- bin/csv2entry.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/csv2entry.sh b/bin/csv2entry.sh index b94e87302..86d3cf21d 100755 --- a/bin/csv2entry.sh +++ b/bin/csv2entry.sh @@ -142,7 +142,7 @@ shopt -s lastpipe # explicitly run the last command of the pipe line in the curr # set variables referenced in the usage message # -export VERSION="1.2.1 2024-08-17" +export VERSION="1.2.2 2024-08-17" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -1311,9 +1311,11 @@ fi # form a 2nd YYYY_DIR inventory from author_wins.csv # if [[ $V_FLAG -ge 5 ]]; then - echo "$0: debug[5]: about to: sed .. $AUTHOR_WINS_CSV | LC_ALL=C sort -t/ -d | uniq > $TMP_2ND_YYYY_DIR_INV" 1>&2 + echo "$0: debug[5]: about to: sed .. $AUTHOR_WINS_CSV | LC_ALL=C sort -t/ -d | LC_ALL=C uniq > $TMP_2ND_YYYY_DIR_INV" 1>&2 fi -sed -e '/^#/d' -e 's/^[^,]*,//' -e 's/,/\n/g' -e 's/_/\//g' "$AUTHOR_WINS_CSV" | LC_ALL=C sort -t/ -d | uniq > "$TMP_2ND_YYYY_DIR_INV" +sed -e '/^#/d' -e 's/^[^,]*,//' -e 's/,/\n/g' -e 's/_/\//g' "$AUTHOR_WINS_CSV" | + LC_ALL=C sort -t/ -d | + LC_ALL=C uniq > "$TMP_2ND_YYYY_DIR_INV" status_codes=("${PIPESTATUS[@]}") if [[ ${status_codes[*]} =~ [1-9] ]]; then echo "$0: ERROR: sed .. $AUTHOR_WINS_CSV | LC_ALL=C sort -t/ -d > $TMP_2ND_YYYY_DIR_INV failed," \