On Wednesday 14 January 2009, you wrote:
David Raleigh Arnold wrote:
On Wednesday 14 January 2009, chip wrote:
Gnarly is an understatement. Those lines of hieroglyphics actually do
something? That's crazy!
You have a point. I found that it didn't work, possibly because of
changes in sed. You need -r to get extended regular expressions
now. Just run this on your chords. A batch file would be very
similar. Make it a .bat, get rid of the top line, change # to
rem. Hopefully you wouldn't need
type %1 | sed
instead of putting the parameter at the ends.
#!/bin/bash
# split-chord
echo "part one"
sed '{
s/<< *\([^ ][^ ]*\) *[^ ][^ ]* *[^ ][^ ]* *>>\([0-9]*\)/\1\2 /g
}' $1
echo "part two"
sed '{
s/<< *[^ ][^ ]* *\([^ ][^ ]*\) *[^ ][^ ]* *>>\([0-9]*\)/\1\2 /g
}' $1
echo "part three"
sed '{
s/<< *[^ ][^ ]* *[^ ][^ ]* *\([^ ][^ ]*\) *>>\([0-9]*\)/\1\2 /g
}' $1
Easy to change << to < and >> to > above for a newer version.
You can put the results in separate files by adding:
}' $1 > yourfile.ly
Usage:
$ ./split-chord file
and copy off the screen, or:
$ ./split-chord file > yourparts.ly
Test:
Contents of file:
<<a b c>> << d e f >>4 <<gb h i>>8
Result:
part one
a d4 gb8
part two
b e4 h8
part three
c f4 i8
Forgot the ,, and ''' but they're ok. I checked. Its done with
spaces and nonspaces. Regards, daveA