#!/usr/bin/perl print"Content-type: text/html\n\n";$a=shift; $b="/";if($a){open(A,"egrep -i $a ~sarang/www/*.html|");while (){s//\>/g;/^www\/([^:]*):(.*)/;($p,$l)=($1,$2); $l=~s/($a)/$1<\/b>/gi;print"$p: '$l'
\n";}} #To use, cd to your cgi-bin directory and do "ln -s YOUR_WEB_DIR ./www" #where YOUR_WEB_DIR is whatever your web dir is, usually ~/public_html #Change $b to the URL of your web dir, usually http://server/~yourname/ #Put this script in your CGI-bin dir as search.pl #To search, access http://server/~yourname/cgi-bin/search.pl #If you have subdirectories in your web dir, this will only search top level #Only searches for one word at a time #Yes, this script sucks :) It's just for example purposes #Written by Sarang Gupta (sarang@sarangworld.com) # Note: This is the script to download if you want to add searching to # your pages. It does not search this website. If you want to actually # search SarangWorld itself, please visit: # http://www.sarangworld.com/search.php3 # Please visit http://www.sarangworld.com/perlscript.php3 for a full list # of my Perl scripts, or http://www.sarangworld.com/ to see my website