Dear list,
I wanted to edit some Pd files so that I can change the coordinates of *some* lines. For example, if in a pd file there is the content:
#N struct 1164-element float x float y float nr float index float nr-show
float tick-show;
#N canvas 168 80 670 664 gui 0;
#X obj 186 548 textfile;
#X obj 167 328 openpanel;
#X obj 395 878 delay;
#X obj 474 838 expr 60*$f1/$f2*1000;
#X msg 166 668 stop;
#X obj 293 207 hradio 17 1 0 6 \$0-instructions \$0-colord-i empty
0 -6 0 8 -134268 -1 -1 0;
I wanted:
a) in the lines beginning with "#X obj", to change the 2 fields afterwards to a general value I'll give in the command (e.g. all lines are changed "#X obj 100 100 ...")
b) to exclude from this operation the line numbers I supply, preferably in an expression such as "5 10 20-30" etc.
To give an example, with the command "100 100 4-6", the text above would be changed to
#N struct 1164-element float x float y float nr float index float nr-show
float tick-show;
#N canvas 168 80 670 664 gui 0;
#X obj 186 548 textfile;
#X obj 167 328 openpanel;
#X obj 395 878 delay;
#X obj 100 100 expr 60*$f1/$f2*1000;
#X msg 166 668 stop;
#X obj 100 100 hradio 17 1 0 6 \$0-instructions \$0-colord-i empty
0 -6 0 8 -134268 -1 -1 0;
where all lines starting with #X obj were change, except for lines 4-6. Further numbers or ranges after 4-6 would indicate other lines to exclude from the replacement.
I know this isn't a task which can be done in Pd, but much better in a language such as lua or python. As I don't know any of these languages, I would appreciate some guidance on how to start, and maybe I could myself continue the work. Preferably I would like to try it in lua, so that I could process it in pdlua. But any suggestions are welcome. Except using grep, as I only have access to an ms-dos console, no bash or similar ones.
Thanks,
jmmmp
_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list