From 3c088b46c42b4470aac4a3d78c0557f54ccba736 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 8 Feb 2007 19:22:16 +0100 Subject: [PATCH] add grml-tips2html.sh, thanks nico --- grml_tips | 12 ++++++--- html/Makefile | 11 +++++++++ html/grml-tips2html.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 4 deletions(-) create mode 100644 html/Makefile create mode 100755 html/grml-tips2html.sh diff --git a/grml_tips b/grml_tips index e044aaf..e5ad0da 100644 --- a/grml_tips +++ b/grml_tips @@ -413,13 +413,17 @@ Test sound: Improved grep version: % glark +-- +Grep with highlighting: -glark grep extract-matches +% grep --color=auto ... +% hgrep ... -- -Highlith +Extract matches when grepping: -grepc -hgrep +Usage examples: +% ifconfig | grepc 'inet addr:(.*?)\s' +% ifconfig | glark --extract-matches 'inet addr:(.*?)\s' -- Output text as sound: diff --git a/html/Makefile b/html/Makefile new file mode 100644 index 0000000..cd09f85 --- /dev/null +++ b/html/Makefile @@ -0,0 +1,11 @@ +all: html online + +html: + cp ../grml_tips grml_tips + ./grml-tips2html.sh + +online: html + scp grml_tips.html grml:/var/www/grml/tips/index.html + +clean: + rm grml_tips grml_tips.html grml_tips.orig diff --git a/html/grml-tips2html.sh b/html/grml-tips2html.sh new file mode 100755 index 0000000..87a1847 --- /dev/null +++ b/html/grml-tips2html.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +OUTFILE=grml_tips.html +INFILE=grml_tips +count=0 + +cp grml_tips grml_tips.orig +cp grml_tips grml_tips.sed +sed -i 's/>/\>/' grml_tips.sed +sed -i 's/ grml_tips.html +cat >> $OUTFILE << EOF + + +grml.org - grml Tips + + + + + + + + + + + + + + + + + + + + + + +EOF + +echo "" >> $OUTFILE +echo "
" >> $OUTFILE
+oifs=$IFS
+IFS=''
+while read LINE
+do  
+    case $LINE in
+        --\ *)
+          count=$(($count + 1))
+          LINE="
${LINE#-- }" + echo "
" >> $OUTFILE + echo $LINE >> $OUTFILE + echo "
" >> $OUTFILE
+          ;;
+        *)
+          echo $LINE >> $OUTFILE
+          ;;
+    esac
+done < $INFILE
+IFS=$oifs
+
+cat >> $OUTFILE << EOF
+
+
+
+EOF
-- 
2.1.4