lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A quick way to change 50 lilypond files


From: hsweet
Subject: Re: A quick way to change 50 lilypond files
Date: Mon, 20 Dec 2010 04:57:04 -0800 (PST)

Search/Replace in an editor is fine for one or 2 files. + I never remember
regex syntax so this way it's written down : ) +I just wanted to avoid
having to do this manually for >50 files. This does them all at once.  50 or
500.  

Here is one I just  thought of... (Haven't tested yet) It should make copies
transposed for clarinet.
$line=~s:\\relative c':\\transpose c b \\relative c':;
$line=~s:\\chordmode:\\transpose c b \ \chordmode:;
$line=~s:Violin:Clarinet:;



hsweet wrote:
> 
> 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.  http://old.nabble.com/file/p30495491/lymod.pl
> lymod.pl 
> 

-- 
View this message in context: 
http://old.nabble.com/A-quick-way-to-change-50-lilypond-files-tp30495491p30498043.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]