From 8380d4cc29f951cd504c3ff02ae546ebc9fd7685 Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Wed, 30 Jul 2025 17:35:51 +0200 Subject: [PATCH] bin: Add no-ansi to remove ANSI escape sequences Similar to `no-ansi-sgr` but removes all ANSI escape sequence, not just the SGR ones. See the previous commit bbf9a1da5881 (bin:no-ansi-sgr: Set LC_ALL=C for `[0-?]` range, 2025-07-30) for an explanation of why LC_ALL has to be set. --- .local/bin/no-ansi | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100755 .local/bin/no-ansi diff --git a/.local/bin/no-ansi b/.local/bin/no-ansi new file mode 100755 index 0000000..2e5c84d --- /dev/null +++ b/.local/bin/no-ansi @@ -0,0 +1,7 @@ +#!/bin/sh +# SPDX-License-Identifier: MIT +# Copyright (c) 2025 Julian Prein +# +# Remove ANSI escape sequences. + +env LC_ALL=C sed 's/\[[0-?]*[ -/]*[@-z]//g'