Hi you all,
this is my first post in this forum. I'm italian (please forgive me) so my english will fail to be correct...
Anyway, let's get straight to the point!
I have a text file like this:
,,,,
Disney: 00961-002,,,,
,Pippo: 00531-002,,,
,,Pluto: 00238-002,,
,,Paperino: 00177-002,,
,,,Paperina: 00121-002,
,,,,Minnie: 00193-002
,,,Paperone: 00434-002,
,,,Paperoga: 00956-002,
,,Gambadilegno: 00715-002,,
,Topolino: 000078-002,,,
,,Basettoni: 00000-002,,
,,Clarabella: 00163-002,,
,,Paperinik: 00511-002,,
,,,Orazio: 00133-002,
The number of commas on the first line indicates the number of levels, those before the item indicate its depth, those after the item may be useless. The number after ":" is not relevant and should not be considered.
Well, I would like to parse it with a shell script (on Debian 8) to get as the following:
<ul><li><span class="tf-nc">Disney</span>
<ul><li><span class="tf-nc">Pippo</span>
<ul><li><span class="tf-nc">Pluto</span></li>
<li><span class="tf-nc">Paperino</span>
<ul> <li><span class="tf-nc">Paperina</span>
<ul><li><span class="tf-nc">Minnie</span></li>
</ul><li><span class="tf-nc">Paperone</span>
<li><span class="tf-nc">Paperoga</span>
</li></ul></li></li><li><span class="tf-nc">Gambadilegno</span></li>
</ul></li><li><span class="tf-nc">Topolino</span>
<ul><li><span class="tf-nc">Basettoni</span></li>
<li><span class="tf-nc">Clarabella</span>
<li><span class="tf-nc">Paperinik</span>
<ul><li><span class="tf-nc">Orazio</span></li>
</ul></li></ul></li></ul></li></ul>
This Html code was written by hand, just to example, but in the real world, the file can contains many many items and many many �levels�
The final result will be, in a web browser, something like the picture you can see here: albertocortesi dot it / output.jpg
Is there anyone who could give me a little help?