From c5536b6527c37da68436a29459e35724aa679e46 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 2 Sep 2009 19:06:27 +0200 Subject: shell2html: convert shell colors to html font tags Signed-off-by: Florian Pritz --- shell2html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 shell2html (limited to 'shell2html') diff --git a/shell2html b/shell2html new file mode 100755 index 0000000..407f40c --- /dev/null +++ b/shell2html @@ -0,0 +1,19 @@ +#!/bin/sh + +COLORS="30=1a1a1a 31=993d6b 32=6b993d 33=996b3d 34=3d6b99 35=6b3d99 36=3d996b 37=cccccc 0=000000 1;30=4d4d4d 1;31=f5007b 1;32=7bf500 1;33=f57900 1;34=007bf5 1;35=7b00f5 1;36=00f57b 1;37=e6e6e6" + +sedstring="" +for it in $COLORS; do + shell=$(echo $it | cut -d= -f1) + html=$(echo $it | cut -d= -f2) + sedstring="${sedstring} s|\[(0)?(;)?${shell}m|\<\/font\>\|g;" +done + +#sedstring="${sedstring} s|||;" +sedstring="${sedstring} s|\[(0)?(;)?m|\<\/font\>\|g;" +sedstring="${sedstring} 1s|^||;" +sedstring="${sedstring} \$s|$||;" + +for file in $@; do + sed -r "${sedstring}" "${file}" +done -- cgit v1.2.3-24-g4f1b