• Filepath column data: basename

    From Sarat Sreepathi@21:1/5 to All on Fri Nov 20 16:18:07 2020
    Hello:

    I have a data file where one of the columns contains full path names. Is there a trick to getting a basename from that field? Any builtins for other transformations on that field?

    Appreciate any pointers.
    Thanks,
    Sarat.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Karl Ratzsch@21:1/5 to All on Sat Nov 21 10:35:52 2020
    Am 21.11.2020 um 01:18 schrieb Sarat Sreepathi:
    Hello:

    I have a data file where one of the columns contains full path names. Is there a trick to getting a basename from that field? Any builtins for other transformations on that field?

    Appreciate any pointers.
    Thanks,
    Sarat.


    Recursion: ;)

    basen(fullp) = (a = strstrt(fullp,'\'), a == 0 ? fullp : basen( substr(fullp,a+1,strlen(fullp) ) ) )

    pr basen('helo')
    pr basen('helo\halo')
    pr basen('helo\halo\holo')

    In the same way you can delete (possibly multiple) .extensions from
    the filename.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Chris Elvidge@21:1/5 to Karl Ratzsch on Sat Nov 21 10:50:56 2020
    On 21/11/2020 09:35 am, Karl Ratzsch wrote:
    Am 21.11.2020 um 01:18 schrieb Sarat Sreepathi:
    Hello:

    I have a data file where one of the columns contains full path names.
    Is there a trick to getting a basename from that field? Any builtins
    for other transformations on that field?

    Appreciate any pointers.
    Thanks,
    Sarat.


    Recursion: ;)

    basen(fullp) = (a = strstrt(fullp,'\'), a == 0 ? fullp : basen( substr(fullp,a+1,strlen(fullp) ) ) )

    pr basen('helo')
    pr basen('helo\halo')
    pr basen('helo\halo\holo')

    In the same way you can delete (possibly multiple) .extensions from the filename.

    Can you use a function?
    e.g. f=system("basename ".fullpath)



    --

    Chris Elvidge, England

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)