On 04/05/2011 03:20 AM, Hellmut Weber wrote:

To make clear what I'm looking for I put it in python code:

leo@sylhepta ~ $ python
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
def shorten_path(path, len):
...   return '/.../' + '/'.join(path.split('/')[-len:])
...
shorten_path('/home/leo/leo/Test/abc',2)
'/.../Test/abc'
Can this be done in (La)TeX?

Yes, but it involves magic. This post
http://stackoverflow.com/questions/2402354/split-comma-separated-parameters-in-latex
describes how to split on commas and this one on spaces
    http://tex.stackexchange.com/questions/12810/how-do-i-split-a-string
They can both be adapted.

Richard

Reply via email to