From 535723f90c75df1b12580c736aa4952acd8dc0ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Sachse?= <joerg.sachse@slub-dresden.de> Date: Fri, 19 Aug 2022 10:23:54 +0200 Subject: [PATCH] fix: handle UTF-8 files correctly when choosing between grep/zgrep --- files/error-summary.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/files/error-summary.sh b/files/error-summary.sh index 9492ee1..9df87e8 100755 --- a/files/error-summary.sh +++ b/files/error-summary.sh @@ -147,8 +147,10 @@ get_last_n_days(){ GREP_CMD="zgrep" elif file -b "${LOGFILE}" | grep "ASCII text" > /dev/null; then GREP_CMD="grep" + elif file -b "${LOGFILE}" | grep "UTF-8 Unicode text" > /dev/null; then + GREP_CMD="grep" else - >&2 echo "ERROR: unknown filetype, cannot find error strings from file '${LOGFILE}.'" + >&2 echo "ERROR: unknown filetype, cannot find error strings from file '${LOGFILE}'." fi ${GREP_CMD} -oP "${FILTER_STRING}" "${LOGFILE}" done | \ -- GitLab