Status : stable
Download : htgrep (5 KB)

This is a frontend to the well known grep tool, using HTML as output. You can first see the matches with a quick glance in the summary part, then jump to a specific context with a single clic, and finally reach the source file if it happens to be online somewhere.

Self documentation

sh: htgrep: command not found

PHP frontend example

You can try it here.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <title>Matches for <?php echo $q ?></title>
 <style type="text/css">
FONT.match { color: #A00000; font-weight: bold }
DIV.code { width: 100%; border: none; background-color: #eeeeee }
TR.title { background-color: #c8c8c8; font-weight: bold; }
TR.match { background-color: #e8e8e8; }

$n $_REQUEST['n'];


<form method=get action="htgrep.php">
<table border=0>
  <td align="right">Search :</td>
  <td><input type=text name="q" size=16 value="<?php echo $q ?>"> <input type=submit value=" OK "></td>
  <td align="right">Context size :</td>
  <td><input type=text name="n" size=4 value="<?php echo $n ?>"></td>

if ($q != "") {
$path '/var/www/';
$prog '/usr/local/bin/htgrep';
$urlbase '';
$q escapeshellarg($q);
  if (!isset(
$n) || !is_int($n)) $n 3;
system("cd '$path' && '$prog' -n '$n' -u '$urlbase$q ngl/include ngl/src");