Register
It is currently Thu Oct 23, 2014 3:57 pm

Bash script to Wikify a offline html page problem


All times are UTC - 6 hours


Post new topic Reply to topic  [ 1 post ] 
Author Message
 PostPosted: Wed Oct 28, 2009 5:28 am   

Joined: Wed Oct 28, 2009 5:24 am
Posts: 1
Hi this script below is working to wikify a page but it is giving me some double outputs, I think it is taking text that is within tags such as <DIV>'s and titles that are in the html. Does anyone know of a way to solve this

#!/bin/sh

echo "<html><title>Wikipedia search for '"$1"'</title><body>"
echo "<center><h1> Wikipedia search for '"$1"'</h1></center></br>"

cd ../Desktop/tmp/cymbeline

cat $1 |sed -n '/<body>/,/</body>/p' | grep -o '[A-Z][a-z]*' | uniq > file.txt


while read file
do

echo $file | sed 's/[A-Z][a-z]*/<a href=\"http:\/\/en.wikipedia.org\/wiki\/&\">&<\/a>/'
grep -m 1 $file $1

done < $1


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP