add grml-tips2html.sh, thanks nico
authorMichael Prokop <mika@grml.org>
Thu, 8 Feb 2007 18:22:16 +0000 (19:22 +0100)
committerMichael Prokop <mika@grml.org>
Thu, 8 Feb 2007 18:22:16 +0000 (19:22 +0100)
grml_tips
html/Makefile [new file with mode: 0644]
html/grml-tips2html.sh [new file with mode: 0755]

index e044aaf..e5ad0da 100644 (file)
--- 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 (file)
index 0000000..cd09f85
--- /dev/null
@@ -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 (executable)
index 0000000..87a1847
--- /dev/null
@@ -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/>/\&gt;/' grml_tips.sed
+sed -i 's/</\&lt;/' grml_tips.sed
+mv grml_tips.sed grml_tips
+
+:> grml_tips.html
+cat >> $OUTFILE << EOF
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<title>grml.org - grml Tips</title>
+<meta name="Title" content="grml.org - grml Tips" />
+<meta name="Author" content="the grml team [www.grml.org/team/]" />
+<meta name="Keywords" content="grml.org, grml" />
+<meta name="Description" content="grml Tips" />
+<meta name="Abstract" content="grml, just another linux-distribution" />
+<meta name="fdse-index-as" content="http://www.grml.org/tips/" />
+<meta name="Robots" content="index,follow" />
+<meta name="Language" content="english" />
+<meta name="identifier-url" content="http://www.grml.org/" />
+<meta name="MSSmartTagsPreventParsing" content="true" />
+<meta http-equiv="imagetoolbar" content="no" />
+<link rel="home" href="/" title="grml.org" />
+<link rel="help" href="/features/" title="About" />
+<link rel="author" href="/team/" title="Team" />
+<link rel="contents" href="/sitemap/" title="Sitemap" />
+<link rel="search" href="/search/" title="Search" />
+<link rel="icon" href="/favicon.png" type="image/png" />
+<meta http-equiv="content-Type" content="application/xhtml+xml; charset=iso-8859-1" />
+<link rel="stylesheet" href="/style.css" type="text/css" />
+</head>
+<body>
+
+EOF
+
+echo "<a name=\"$count\"></a>" >> $OUTFILE
+echo "<pre>" >> $OUTFILE
+oifs=$IFS
+IFS=''
+while read LINE
+do  
+    case $LINE in
+        --\ *)
+          count=$(($count + 1))
+          LINE="<a name=\"$count\"></a><hr />${LINE#-- }"
+          echo "</pre>" >> $OUTFILE
+          echo $LINE >> $OUTFILE
+          echo "<pre>" >> $OUTFILE
+          ;;
+        *)
+          echo $LINE >> $OUTFILE
+          ;;
+    esac
+done < $INFILE
+IFS=$oifs
+
+cat >> $OUTFILE << EOF
+
+</body>
+</html>
+EOF