For those who have Macs, I have a little "droplet" application which runs
with MacPerl. Drag an abc file to the droplet and it produces a file called
alphabetical.abc.

You can get it at:
http://www.sls.hawaii.edu/bley-vroman/abc/tunesort.drp.sit

You'll also need MacPerl:
http://www.macperl.com/

Robert Bley-Vroman
Honolulu
----------------------

For geeks, here's the source:

#!/usr/bin/perl
# tunesort.pl

#!perl -w

# For sorting a file of abc tunes into alphabetical order by title.
# Assumes that tunes are "paragraphs" separated by blank lines and
# that every paragraph is a tune. This will mess up if the file
# contains paragraphs of non-tune material.
#
# Robert Bley-Vroman [EMAIL PROTECTED] April 10, 2002.

$/ = "";   #Set the record separator to null to read in "paragraph mode"

open (OUT, '>alphabetical.abc') or die "Can't open the output file.";

print "Reading input file:\n\n";

while (defined ($line = <>)) {
  $line =~ /T: *(.*)\n/;
  print "$1\n";
  $tune_hash{$1} = $line;
}

print "\n\nWriting output file:\n\n";

foreach $title (sort keys %tune_hash)
{
   print "$title\n";
   print OUT $tune_hash{$title};
}

print "\nDONE\n";





>------------------------------
>
>Date: Fri, 12 Sep 2003 09:00:09 +0200 (CEST)
>From: Martin Tarenskeen <[EMAIL PROTECTED]>
>Subject: Re: [abcusers] Sorting abc files
>
>On Thu, 11 Sep 2003 [EMAIL PROTECTED] wrote:
>
>> I don't know of anything that can do what you want, so I wrote
>> something (yes, I'm a geek).  It's a short perl script that takes as
>> input your ABC file, and creates a new file myfile.abc.new which has
>> the tunes sorted by title.  I uploaded the script to my webspace at
>> http://members.cox.net/chrismyers/sort_abc.pl so you can download it
>
>Nice contribution ! I could use it right away on my Atari MiNT system,
>which also has Perl installed on it. (I only had to change
>/usr/local/bin/perl into /usr/bin/perl in the first line of the script)
>
>It shouldn't be too hard to write a little standalone C program with the
>same functionality. Or maybe Seymour Shlien (or someone else) can add a
>alphabetical tune-sorting option to abc2abc that is part of the abcMIDI
>package.
>
> --
>
>Martin Tarenskeen
>


To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html

Reply via email to