Searching for text

robinsiebler robinsiebler at 321.net
Mon Aug 28 20:01:13 EDT 2006


I have a batch of files that I am trying to search for specific text in
a specific format.  Each file contains several items I want to search
for.

Here is a snippet from the file:
...
/FontName /ACaslonPro-Semibold def
/FontInfo 7 dict dup begin
/Notice (Copyright 2000 Adobe Systems Incorporated. All Rights
Reserved.Adobe Caslon is either a registered trademark or a trademark
of Adobe Systems Incorporated in the United States and/or other
countries.) def
/Weight (Semibold) def
/ItalicAngle 0 def
/FSType 8 def
...

I want to search the file until I find '/FontName /ACaslonPro-Semibold'
and then jump forward 7 lines where I expect to find '/FSType 8'.  I
then want to continue searching from *that* point forward for the next
FontName/FSType pair.  Unfortunately, I haven't been able to figure out
how to do this in Python, although I could do it fairly easily in a
batch file.  Would someone care to enlighten me?




More information about the Python-list mailing list