Mick <michaelkintzios <at> gmail.com> writes:

> some-description-with-words-012-63099.jpg
> The number and length of the words change for each file.  The part number 
> always has two components separated by a hyphen, but may also change 
> in length and acquire more/fewer digits.  I need two outputs:

> 1. the description + " (per M²)", like so:
> some-description-with-words (per M²)

My experience with scripting as to what you exactly need, suggests
a trial an error process. I'd take a sampling of the names of the 
files and post them up somewhere where folks can first test an actual script
against some of the actual filenames as to your specification needs.

https://gist.github.com/

Bash is probably quickest, but it might be great fun to test some python
code too (note, I'm just learning/noodling with python codes, but it
is a quite pleasurable journey tinkering around with python codes.


> 2. the part number, but replacing the hyphen with "/", like so: 
> 012/63099

Here is some /awk/ reference that might give you the ideas you need::

http://www.grymoire.com/Unix/Awk.html#uh-46

There was also a recent thread on gentoo-dev about revision numbering
intricacies that was fascinating to read as to the tricks to sort numbers
that use a variety of details as to what number is next in a sequence. If
one can discern that thread in detail, surely your questions a small subset
of those tricks described or alluded to therein.


hth,
James


Reply via email to