J
Joan Miller
I believe you're working on Linux, so how about using "sed"? Here's a
(prettified) BASH transcript of a sed script (edit.sed) transforming a
6-line text file (myprog.py). The text file has both Python statements
and "special commands", which have "$ " at the beginning of the line.
>>> cat myprog.py
print "hello"
$ ls -l
r = range(10)
$ grep foo bar.data
pass
print "bye"
>>> cat edit.sed
s/^\$ \(.*\)/Run("\1")/
>>> sed -f edit.sed data.txt
print "hello"
Run("ls -l")
r = range(10)
Run("grep foo bar.data")
pass
print "bye"
-John
Yes, this would a well solution. Simple and fast to build.