Hi everyone...
I posted about this before, but I'm still having some problems. My script below reads (or trys to at least) read in lines of a file and then see if some part of the line matches the input from the user, $1..
Here's a sample text file that I have been using with some random images... if I search for "cookie", the image for cookie is displayed 8 times... I want it to display once.. and if I search for book.. i want picture 7 and 1 to show up..
Any help would be REALLY appreciated.. thanks.
glg2296/art/images/picture1.jpg:author:cookie
glg2296/art/images/picture2.jpg:author:chair
glg2296/art/images/picture3.jpg:author:apple
glg2296/art/images/picture4.jpg:author:grapes
glg2296/art/images/picture5.jpg:author:car
glg2296/art/images/picture6.jpg:author:monkey
glg2296/art/images/picture7.jpg:author:book
glg2296/art/images/picture1.jpg:author:book
#!/bin/sh
echo "Content-type: text/html"
echo
counter=`wc -l "
for (( i=0; i"
#cat line.txt
#grep "$1" database.txt >temp.txt
#grep "$1" $line > results.txt
grep $1 database.txt> temp.txt
#cat temp.txt
p=`awk -F: '{print $1}' temp.txt | sed 's#//##'`
#p=`awk -F: '{print $1}' results.txt | sed 's#//##'`
#cat temp.txt
echo ""
echo ""
#rm temp.txt