changeset 649:cffd91855f61

Added script stripping ANSI sequences (colors).
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Tue, 26 Feb 2019 10:27:05 +0200
parents 898e6d98f933
children 0c73b52edf9a
files misc/Makefile misc/my-term-strip-ansi
diffstat 2 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/misc/Makefile	Wed Dec 19 01:06:46 2018 +0200
+++ b/misc/Makefile	Tue Feb 26 10:27:05 2019 +0200
@@ -53,7 +53,7 @@
 ################################################################
 # Files definitions.
 
-FILES = trac-digest.sh find-ext.sh line-count.sh $(wildcard cleanupdoc-*.sh) mymake.sh my-ascii.sh my-colors.sh
+FILES = trac-digest.sh find-ext.sh line-count.sh $(wildcard cleanupdoc-*.sh) mymake.sh my-ascii.sh my-colors.sh my-term-strip-ansi
 
 ################################################################
 # Build targets.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/misc/my-term-strip-ansi	Tue Feb 26 10:27:05 2019 +0200
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [ -n "$1" ]; then
+    sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" "$1"
+else
+    sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g"
+fi
+