I had a bunch of band charts I needed to update. I wanted to assign each chart a number and give them all a midi tempo. Then every now and then I learn something new that I want to add.
I dusted off an old Perl script, changed a few lines and I was able to automate the process. It reads all the lilypond files in a folder, reads and changes the text inside and writes the updated file to a temporary folder called "changed". Open to the changed folder in a terminal, type "lilypond *" and lily will recompile everything.
The key to the whole thing is the line=~s/xxx /yyy / lines. If you have ever used regex it will make sense.
open(OUT, ">changed/$file"); #output is to a folder called "Changed" one level deeper in tree
foreach my $line(@text){
$line=~s:\\date:\\italic{ \"Sheet $cnt | Updated \" \\date } :;
$line=~s:\\midi { }:$midistring:;
print OUT $line;
}
This is the whole program. lymod.pl
View this message in context: A quick way to change 50 lilypond files
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.