[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: splitting chords entered as <<c e g>>
From: |
David Raleigh Arnold |
Subject: |
Re: splitting chords entered as <<c e g>> |
Date: |
Thu, 15 Jan 2009 12:18:30 -0500 |
User-agent: |
KMail/1.9.9 |
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
--
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