Melodeon.net Forums

Please login or register.

Login with username, password and session length
Advanced search  

News:

Welcome to the new melodeon.net forum

Pages: [1]   Go Down

Author Topic: Creating an index  (Read 2759 times)

0 Members and 1 Guest are viewing this topic.

Andy Next Tune

  • aka Andy Wooles
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1127
  • Melodeon with Accidentals? Make a PI Claim!!!
    • www.shavethedonkey.co.uk
Creating an index
« on: November 05, 2015, 08:14:10 PM »

I maintain our band's tunebook in an ever expanding ABC file.
It is organised/sorted into dance sets and tune types by structured use of the X: field.

My challenge is to find a straight-forward mechanism to produce from the ABC file a complete alpha list of tunes referencing the X field.

Any suggestions?

BTW I use ABCExplorer/Windows10.
Logged
Andy, from the now ex-County Palatine of Cheshire

Caring for a European community of melodeons from France, Italy, Germany, Wales and Suffolk!

Jack Campin

  • Hero Member
  • *****
  • Offline Offline
  • Posts: 764
    • Jack Campin's Home Page
Re: Creating an index
« Reply #1 on: November 05, 2015, 09:00:45 PM »

BarFly (for old Macs) lets you extract header fields of your choice into a tab-separated file.

You could program something like that quite easily in Unix using the standard text processing utilities. If you have Perl you should be able to do the same sort of thing with much greater obscurity.

Or get Python. It's a lot more readable and somebody here must know it.
Logged
http://www.campin.me.uk/

I can't figure out how to quit but I will no longer check this group and have deleted all shortcuts to it.

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6767
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: Creating an index
« Reply #2 on: November 05, 2015, 11:01:32 PM »

You could program something like that quite easily in Unix

If the abc files are all in the same directory tree and you are in the root of that tree, all you need is:
Code: [Select]
grep -r ^T: . >abcindex.txt (lots of variations on this are possible)
Logged
Слава Україні !
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk

Chris Ryall

  • "doc 3-row"
  • French Interpreter
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 11153
  • Wirral UK
    • Chris Ryall
Re: Creating an index
« Reply #3 on: November 06, 2015, 09:20:06 AM »

   
    grep -r ^T: . >abcindex.txt

    (lots of variations on this are possible)

Gosh, is it THAT easy? ::)

  (And wasn't Grep the chap that wrote Enigma Variations)?
Logged
  _       _    _      _ 

Lester

  • MADman
  • Mods and volunteers
  • Hero Member
  • ***
  • Offline Offline
  • Posts: 9327
  • Hohners'R'me
    • Lester's Melodeon Emporium and Tune-a-Rama
Re: Creating an index
« Reply #4 on: November 06, 2015, 09:23:55 AM »

What I do for my band work is:

Open the band.abc in LibreOffice (cheapskate Word).
Use it to put a page break before each X: to get a tune a page.
Then apply a H1 style to each line starting T:.
Auto generate an Table of Contents.
Export the whole shooting match to PDF which I view, via DropBox, on my tablet should I need it during bookings.

Not exactly what you want but should give you some ideas  ;)

Andy Next Tune

  • aka Andy Wooles
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 1127
  • Melodeon with Accidentals? Make a PI Claim!!!
    • www.shavethedonkey.co.uk
Re: Creating an index
« Reply #5 on: November 06, 2015, 09:39:05 AM »

Thanks Anahata, Jack.

Unfortunately I do not have Unix/Linux (everything is on Windows10), and programming with perl, Python etc is not a current skill.

But the comment about BarFly extracting headers pushed me to re-check ABCExplorer again. And it has a similar function...

Under Tools, there is a utility to Extract Field Contents..... , including a button (I missed it previously) to export 'full index to a Text file'.
The resulting file cross-references the selected field e.g. T: to the X: field - just what I was looking for!

Interestingly, it would appear that the index file generated is for all ABC files open in ABCExplorer at that time. So if you have a number of large ABC archives, as I have, then it provides a simple mechanism to create a consolidated or meta index.

Logged
Andy, from the now ex-County Palatine of Cheshire

Caring for a European community of melodeons from France, Italy, Germany, Wales and Suffolk!

Anahata

  • This mind intentionally left blank
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 6767
  • Oakwood D/G, C/F Club, 1-rows in C,D,G
    • Treewind Music
Re: Creating an index
« Reply #6 on: November 06, 2015, 12:24:58 PM »

The Mac has a unix-like operating system, which leads to the ironic conclusion that OSX can be recommended over Windows because of its superior command line interface  :o

Windows does have a command line (I'm sure it's still there even in W10) and the FIND command, but most Windows command line programs (even though they've got better since DOS) are hopelessly inadequate and lacking in joined-up thinking.

    grep -r ^T: . >abcindex.txt
    (lots of variations on this are possible)
Gosh, is it THAT easy? ::)

The thing is, once you've figured it out, you can put that into a one-line script or alias and the next time you want to use it all you have to remember is what you called it.
« Last Edit: November 06, 2015, 12:27:09 PM by Anahata »
Logged
Слава Україні !
Music recording and web hosting: www.treewind.co.uk
Mary Humphreys and Anahata: www.maryanahata.co.uk
Ceilidh band: www.barleycoteband.co.uk

syale

  • The Terrier
  • Hero Member
  • *****
  • Offline Offline
  • Posts: 711
  • When will this MADness stop?
Re: Creating an index
« Reply #7 on: November 07, 2015, 01:52:29 AM »

Powershell is much more script friendly than DOS!

http://blogs.msdn.com/b/powershell/archive/2008/03/23/select-string-and-grep.aspx

Stephen
Logged
HA114 C/G/A/D, 2915 G/C. Liliput, Club IIB C/F Dino Baffetti Modell 22 B Twitter: @syale
Pages: [1]   Go Up
 


Melodeon.net - (c) Theo Gibb; Clive Williams 2010. The access and use of this website and forum featuring these terms and conditions constitutes your acceptance of these terms and conditions.
SimplePortal 2.3.5 © 2008-2012, SimplePortal