On 02/11/14 02:03, Charlie Garrison wrote:
> Good morning,
>
> On 1/11/14 at 12:49 PM +0100, Marek Stepanek
> <[email protected]> wrote:
>
>> But how to align the last 10. Takt with sprintf()?
>
> I don't recall specifics, but I'm pretty sure dash character will right
> align, so something like this:
>
> sprintf("%-30.10s",$increment)
>
> I doubt that is actually correct, maybe dash needs to go before the 's'.
> Anyway, there is some way to right align the string using sprintf, check
> perldoc.
>
>
> Charlie
>
Thank you Charlie!
I found meanwhile following solution. Probably too complicate approach,
but working nicely:
#!/usr/bin/perl
use warnings;
use strict;
my $increment = 0;
while (<DATA>) {
if (/\s*\d+\.\sTakt/) {
next if /^\s+$/;
++$increment;
s/^([^%]+)(%)\s*\d+\.\sTakt$/sprintf("%-33s %s %20s .
Takt",$1,$2,$increment)/eg;
}
print;
}
__DATA__
\NOtes\qu{ABCD}\enotes\barre % 6. Takt
\NOtes\qu{EFGH}\enotes\barre % 7. Takt
\NOtes\ql{IJKL}\enotes\barre % 8. Takt
\NOtes\ql{MNOP}\enotes\barre % 9. Takt
\NOtes\ql{QRST}\enotes\barre % 10. Takt
\setclef1{\treble}\changeclefs%
\NOtes\qu{abcd}\enotes\barre % 1. Takt
\NOtes\qu{efgh}\enotes\barre % 2. Takt
\NOtes\ql{ijkl}\enotes\barre % 3. Takt
\NOtes\ql{mnop}\enotes\barre % 4. Takt
\NOtes\sk\ql{qrst}\enotes\barre %5. Takt
--
This is the BBEdit Talk public discussion group. If you have a
feature request or would like to report a problem, please email
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].