On Wednesday 14 January 2009, chip wrote: > I have a piece with three voices where all the notes where entered in > this format - > << c e g>> << d f a> etc for the entire piece. > Is there a way to have Lily split out the 3 voices into separate parts, > or do I have to rewrite the entire .ly file? > Thanks, > Chip > > > _______________________________________________ > lilypond-user mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/lilypond-user >
It could be done with an editing tool, such as sed. "s" is for substitute. Substitute << followed by any number of spaces followed by \( at least one nonspace \) . Replace that with a space followed by \1, which retrieves what was between the escaped parentheses. followed by another space. That gets the first pitch in each chord. s/<< *\([^ ]+\)/ \1 /g Now add whatever is after >> in a similar way, except the * means any number of, while the plus meant at least one nonspace [^ ]: s/<< *\([^ ]+\).*>>\([^ ]*\)/ \1\2 /g Cat or type your chords through sed with that command, and you have the first part. To get the next part, add to it. s/<< *[^ ]+ +\([^ ]+\).*>>\([^ ]*\)/ \1\2 /g and the next: s/<< *[^ ]+ +\([^ ]+[^ ]+ +\([^ ]+\).*>>\([^ ]*\)/ \1\2 /g Don't do sed in place ($ sed -i). If I haven't messed up, you've got it. GNU sed is gnarly but powerful. ;-) Regards, daveA -- Free download of technical exercises worth a lifetime of practice: http://www.openguitar.com/dynamic.html :::: You can play the cards you're dealt, or improve your hand with DGT. Very easy guitar music, solos, duets, exercises.., To contact, visit openguitar.com _______________________________________________ lilypond-user mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-user
