From 3269d530a2993a82b94ade45f2b9668bd2296ff9 Mon Sep 17 00:00:00 2001 From: Alejandro Mery Date: Mon, 19 Oct 2020 22:21:22 +0100 Subject: [PATCH] pcat: combine `sed | sed` when there is no `grep` call Signed-off-by: Alejandro Mery --- files/bin/pcat | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/files/bin/pcat b/files/bin/pcat index 6347de7..36b07f4 100755 --- a/files/bin/pcat +++ b/files/bin/pcat @@ -149,6 +149,12 @@ if [ -n "${FROM:-}${UNTIL:-}" ]; then [ -z "${FROM:-}" ] || PIPELINE="$PIPELINE -e '0,/$FROM/d'" [ -z "${UNTIL:-}" ] || PIPELINE="$PIPELINE -e '/$UNTIL/,\$d'" + + # no grep? combine both sed calls + if [ -z "${GREP_ARGS:-}" -a -n "${SED_ARGS:-}" ]; then + PIPELINE="$PIPELINE $SED_ARGS" + SED_ARGS= + fi fi # GREP FILTER