Search engine in a few lines

A simple search engine written in perl !

#!/bin/sh

echo "Content-type: text/html"
echo

echo '<html> <head> <title> Results </title> </head> <body>'

argument=`echo "$QUERY_STRING" | sed "s|q=||"`

cd /<your web server root directory>

echo '<pre>'
grep -i "$argument" *html */*html | sed -e 's|<|\&lt;|g' -e 's|>|\&gt;|g'
echo '</pre>'

Now all you do is run this under your web server root directory with appropriate permissions. 

viola ! with the power of the shell and perl you could do magic.
Advertisement

0 Responses to “Search engine in a few lines”



  1. Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s





Follow

Get every new post delivered to your Inbox.