I've spent all afternoon trying to make an index of just the titles in a few abc files. I did it last year and had very clean indexes from the file but I can't remember what software I used. Today, I've tried abctools, abceditor, abcfind, mcmusiceditor, abcexplorer.
The closest I got was abceditor but the index it turns out also includes the tune number. I thought I might have used abcmus but I'm now running windows 7, 64 bit Home Premium and I can't get that to work.
BarFly for the Mac lets you export the header fields in a configurable tab-separated format.
You can do the same thing with Unix text processing utilities like sed and awk. I think there are versions of those for Windows. (Don't the most recent versions of Windows provide you with some sort of rudimentary Unix shell as an application program? - that should do it, if it's sophisticated enough to support pipes as Unix had them in the mid-1970s).
In the Terminal on my Mac (should be the same in any Unix environment) this does it:
The one problem is that if you have multiple titles listed in the header of your ABCs, you'll get all the titles... (Or maybe that's a feature, not a bug)
I was going to suggest the same as Rick Payman. I used to do that sort of thing a lot. But recently I find myself opening 'ABC-like' text files in Excel, all into one field, sorting the lines and then messing around with them.
For example: Open the file in Excel, all into one column. Fill another column with numbers 1,2 3 etc (put in the first few then fill down). Sort by the column with the ABC, delete all except lines starting T: and X: Sort by the number column, then use assorted formula on the corresponding fields to get a list of Title against 'X:value'. Tricky if you have multiple T: lines but with an afternoon to spare it could be done !
Thanks for all the input. I have too many tunes to go through the files and cleaning it up with tune at a time. It was ABCmus that I used to use to get my indexes. It normally doesnt run in Windows 7 but it does run in the Virtual PC under the XP mode in Win 7.
To get clean and easy indexes you click in the 'make list' tab in the main window of abcmus. In the new window under the 'list type' you select 'index'. After that you click on 'edit' next to that tab and click on 'output'. Here, delete everything except %#40.T. By doing this it will give you and output file with only the titles.
Finish off by selecting your file, choosing a name for your output file and clicking ok. As I said, you'll get a text file with the list of the names and nothing else.
If you can't do pipes in your environment, this will do the same thing as my previous suggestion (like that one, it leaves nothing that needs to be edited out):
sed -n '/^T:/s/T://p' *.abc
Not quite as efficient but unless you have millions of tunes you won't see the difference.
http://www.cygwin.com/ will give you a unix-like environment on a windows machine. It won't work on 64-bit machines, and it does take a lot of disk-space. I tend to edit my abc files using Elvis - a Windows-compatible version of the unix "vi".
Hunting for Tune Names in Windows is pathetic. I have not ever managed to find what I'm looking for. Much easier to port them into a Unix environment and use "grep".
"It really doesn't look like Microsoft wants you to do this."
I first looked at Linux when I started hearing rumours of a program called abc2mtex. I read up on how to install TeX on dos 5, and concluded it would probably be easier to install and learn a whole new OS instead.
Microsoft comes with an extremely powerful (not just for Microsoft, but really powerful in general) scripting language that can extract tune names without much bother from an abc file.
One line script from powershell prompt in directory containing ABC file...
> Get-Content tunebook.abc | where {$_.length -gt 0} | where {$_.substring(0,2) -eq 'T:'} | Sort-Object
Get-Content: returns the contents of a file as an array of lines of text.
The results are piped into a filter which removes empty lines.
Those results are piped into a filter which removes any lines that don't begin with 'T:'
Finally, the remaining items (tune titles) are sorted alphabetically.
Powershell is free with Windows Vista & Windows 7 & is a free download for Windows OSes back to Windows XP.
Those who are using ABCexplorer can already easily do this.
A full explanation can be found in the Help File under 'Window of Printable List'.
Here is how in a more user friendly way:-
How to build customized indexes in ABCexplorer:
All the files that you have opened will be indexed; close the files that you don't want to index.
1) In the tab 'Filter', select 'Filter and replace list' (or 'add to list'). If you want to select all the tunes in all the open files, then leave all the filtering boxes empty. If you want to preselect the sort of tunes you want to index, then choose your filter now, to select only the sort of tunes that you want to add to the index.
2) Press 'Apply filtering'. The tunes selected by your filtering are now copied into the Temporary List, not in alphabetical order yet.
3) In the menu of the Temporary List (in the Menu Bar or by right clicking in the list), select 'Export list' > 'Convert into a printable list': The 'Printable List' edit window is now displayed. You will see that the list has become alphabetical.
4) You can select the fields you want to include in the file by checking the boxes in the drop-down list "Include". The index can be exported as either a text file, or *.csv or *.tsv. For a text file, you can choose the separator between the fields (default is "/").
need help making an index of an abc file
need help making an index of an abc file
I've spent all afternoon trying to make an index of just the titles in a few abc files. I did it last year and had very clean indexes from the file but I can't remember what software I used. Today, I've tried abctools, abceditor, abcfind, mcmusiceditor, abcexplorer.
The closest I got was abceditor but the index it turns out also includes the tune number. I thought I might have used abcmus but I'm now running windows 7, 64 bit Home Premium and I can't get that to work.
Any ideas? Thanks in advance!
# Posted on November 6th 2011 by mimicabin
Re: need help making an index of an abc file
BarFly for the Mac lets you export the header fields in a configurable tab-separated format.
You can do the same thing with Unix text processing utilities like sed and awk. I think there are versions of those for Windows. (Don't the most recent versions of Windows provide you with some sort of rudimentary Unix shell as an application program? - that should do it, if it's sophisticated enough to support pipes as Unix had them in the mid-1970s).
In the Terminal on my Mac (should be the same in any Unix environment) this does it:
sed -n '/^T:/p' *.abc | sed 's/T://'
(ugly but I'm years out of practice).
# Posted on November 6th 2011 by Jack Campin
Re: need help making an index of an abc file
You just want a list of the titles ? Why not load the ABC file into an ordinary text editor and delete the bits you don't want ?
# Posted on November 6th 2011 by Richard Robinson
Re: need help making an index of an abc file
(If you /want/ to get all unixcommandliney, I think "grep T: *.abc" would do the same thing - just print all the title lines to the terminal)
# Posted on November 6th 2011 by Richard Robinson
Re: need help making an index of an abc file
No cigar - try it.
# Posted on November 6th 2011 by Jack Campin
Re: need help making an index of an abc file
You can just do

grep T: <your file(s)> | sed s/T://
The one problem is that if you have multiple titles listed in the header of your ABCs, you'll get all the titles... (Or maybe that's a feature, not a bug)
# Posted on November 6th 2011 by Reverend
Re: need help making an index of an abc file
From a DOS command shell (Run CMD), you could try something like:
find "T:" file.abc > index.txt
You would still have to manually edit alternative titles for the same tune (and theT: prefix).
# Posted on November 6th 2011 by Rick Payman
Re: need help making an index of an abc file
I was going to suggest the same as Rick Payman. I used to do that sort of thing a lot. But recently I find myself opening 'ABC-like' text files in Excel, all into one field, sorting the lines and then messing around with them.
For example: Open the file in Excel, all into one column. Fill another column with numbers 1,2 3 etc (put in the first few then fill down). Sort by the column with the ABC, delete all except lines starting T: and X: Sort by the number column, then use assorted formula on the corresponding fields to get a list of Title against 'X:value'. Tricky if you have multiple T: lines but with an afternoon to spare it could be done !
# Posted on November 6th 2011 by David50
Re: need help making an index of an abc file
Thanks for all the input. I have too many tunes to go through the files and cleaning it up with tune at a time. It was ABCmus that I used to use to get my indexes. It normally doesnt run in Windows 7 but it does run in the Virtual PC under the XP mode in Win 7.
To get clean and easy indexes you click in the 'make list' tab in the main window of abcmus. In the new window under the 'list type' you select 'index'. After that you click on 'edit' next to that tab and click on 'output'. Here, delete everything except %#40.T. By doing this it will give you and output file with only the titles.
Finish off by selecting your file, choosing a name for your output file and clicking ok. As I said, you'll get a text file with the list of the names and nothing else.
# Posted on November 7th 2011 by mimicabin
Re: need help making an index of an abc file
Meanwhile, sed for Windows:
http://gnuwin32.sourceforge.net/packages/sed.htm
You will find it useful for other things.
If you can't do pipes in your environment, this will do the same thing as my previous suggestion (like that one, it leaves nothing that needs to be edited out):
sed -n '/^T:/s/T://p' *.abc
Not quite as efficient but unless you have millions of tunes you won't see the difference.
# Posted on November 7th 2011 by Jack Campin
Re: need help making an index of an abc file
http://www.cygwin.com/ will give you a unix-like environment on a windows machine. It won't work on 64-bit machines, and it does take a lot of disk-space. I tend to edit my abc files using Elvis - a Windows-compatible version of the unix "vi".
Hunting for Tune Names in Windows is pathetic. I have not ever managed to find what I'm looking for. Much easier to port them into a Unix environment and use "grep".
# Posted on November 7th 2011 by Innocent Bystander
Re: need help making an index of an abc file
Well our abc projects does that (first title only). http://www.folkinfo.org/abcprojects/projectdetail.php?detailid=18
The basic php code for that one is
[code]
$abc = file_getcontents("abcfile")
$abc = explode("\r\n", $abc);
$inX = false;
$count = 0;
foreach ($abc as $abcline){
$tmpline = trim($abcline);
if (substr($tmpline, 0, 2) == "X:"){
$X = substr($tmpline,2);
$inX = true;
}
elseif (substr($tmpline, 0, 2) == "T:"){
if ($inX){
$T = substr($tmpline, 2);
$inX = false;
echo "$X: $T\r\n";
$count++;
}
}
}
echo "$count tunes listed";
[/code]
# Posted on November 7th 2011 by Jon Freeman
Re: need help making an index of an abc file
Perhaps I should add php is a general purpose scripting language that can be run from the command line. Its use is not limited to web sites.
# Posted on November 7th 2011 by Jon Freeman
Re: need help making an index of an abc file
"Grep" does all titles, not just the first one.
# Posted on November 7th 2011 by Innocent Bystander
Re: need help making an index of an abc file
I didn't realize Unix on Windows was this bad:
http://en.wikipedia.org/wiki/Windows_Services_for_UNIX
It really doesn't look like Microsoft wants you to do this.
# Posted on November 7th 2011 by Jack Campin
Re: need help making an index of an abc file
"It really doesn't look like Microsoft wants you to do this."
I first looked at Linux when I started hearing rumours of a program called abc2mtex. I read up on how to install TeX on dos 5, and concluded it would probably be easier to install and learn a whole new OS instead.
15-odd years later, I don't think I was wrong.
# Posted on November 7th 2011 by Richard Robinson
Re: need help making an index of an abc file
Microsoft comes with an extremely powerful (not just for Microsoft, but really powerful in general) scripting language that can extract tune names without much bother from an abc file.
One line script from powershell prompt in directory containing ABC file...
> Get-Content tunebook.abc | where {$_.length -gt 0} | where {$_.substring(0,2) -eq 'T:'} | Sort-Object
Get-Content: returns the contents of a file as an array of lines of text.
The results are piped into a filter which removes empty lines.
Those results are piped into a filter which removes any lines that don't begin with 'T:'
Finally, the remaining items (tune titles) are sorted alphabetically.
Powershell is free with Windows Vista & Windows 7 & is a free download for Windows OSes back to Windows XP.
# Posted on November 9th 2011 by HipCzeck
Re: need help making an index of an abc file
Those who are using ABCexplorer can already easily do this.
A full explanation can be found in the Help File under 'Window of Printable List'.
Here is how in a more user friendly way:-
How to build customized indexes in ABCexplorer:
All the files that you have opened will be indexed; close the files that you don't want to index.
1) In the tab 'Filter', select 'Filter and replace list' (or 'add to list'). If you want to select all the tunes in all the open files, then leave all the filtering boxes empty. If you want to preselect the sort of tunes you want to index, then choose your filter now, to select only the sort of tunes that you want to add to the index.
2) Press 'Apply filtering'. The tunes selected by your filtering are now copied into the Temporary List, not in alphabetical order yet.
3) In the menu of the Temporary List (in the Menu Bar or by right clicking in the list), select 'Export list' > 'Convert into a printable list': The 'Printable List' edit window is now displayed. You will see that the list has become alphabetical.
4) You can select the fields you want to include in the file by checking the boxes in the drop-down list "Include". The index can be exported as either a text file, or *.csv or *.tsv. For a text file, you can choose the separator between the fields (default is "/").
# Posted on November 11th 2011 by Chrisp