Sick of doing research manually?

I was too. It really annoys me to have to search through text for relevant facts, so I wrote this small script to parse text quickly looking for keywords and save the resultant facts to a second text file. Quite simple, but perhaps useful. You’ll need Python (www.python.org) to run it.

 #Scoper v1.0 by Raven (EyesOfARaven), October 10, 2007
import sys
f=file(raw_input(“File->”))
kw=raw_input(“Keyword->”).lower()
of=file(raw_input(“Outfile->”),”w”)
count=0
linecount=0
for line in f.readlines():
    linecount+=1
    print “Parsing line “+str(linecount)
    if not ((line.lower()).find(kw)==-1):
        of.write(line+”\r\n”)
        count+=1
        print “Found on “+str(linecount)+”, “+str(count)+” total.”
    else:
        print “Not found on line “+str(linecount)
else:
    print “Parsing Completed, “+str(count)+” of “+str(linecount)+” lines contained “+’”‘+kw+’”.’
sys.exit(1)

Advertisement

~ by raven on October 10, 2007.

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.