Hi and thanks everyone for the enlightenment. I guess pyparsing is the
way to go then. I just installed it and am trying it out. It looks
good for all the stuff I need to do in Nuke frequently. I am going to
do a bit of testing with Paul's solution.
Cheers
Pete
__
"Pete O'Connell" wrote
I am always looking for the line " name Write1" as my starting point. In
the
first example below, I want to replace the path, which is 2 lines above
it.
I have made a basic script to do that and it works fine. The problem I am
having is when the number of lines between
This is a good little pyparsing exercise. Pyparsing makes it easy to define
the structure of a "Write { ( )* }" block, and use the names
given to the parsed tokens to easily find the "name" and "file" entries.
from pyparsing import (Literal, Word, alphanums, empty, restOfLine, dictOf)
# make up
Pete O'Connell wrote:
Write {
file /Volumes/raid0/Z353_002_comp_v27.%04d.cin
file_type cin
name Write1
xpos 13762
ypos -364
}
The simplest approach imho is to parse the input with a proper parser, eg PLY
or pyparsing.
If you want to do the parsing manually, I'd start by classifying eac