Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #4373 > unrolled thread

Filepath column data: basename

Started bySarat Sreepathi <sarat@ornl.gov>
First post2020-11-20 16:18 -0800
Last post2020-11-21 10:50 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Filepath column data: basename Sarat Sreepathi <sarat@ornl.gov> - 2020-11-20 16:18 -0800
    Re: Filepath column data: basename Karl Ratzsch <mail.kfr@gmx.net> - 2020-11-21 10:35 +0100
      Re: Filepath column data: basename Chris Elvidge <chris@mshome.net> - 2020-11-21 10:50 +0000

#4373 — Filepath column data: basename

FromSarat Sreepathi <sarat@ornl.gov>
Date2020-11-20 16:18 -0800
SubjectFilepath column data: basename
Message-ID<2f8a72a5-b4c1-40d4-ae13-8634463cd5bcn@googlegroups.com>
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.

[toc] | [next] | [standalone]


#4374

FromKarl Ratzsch <mail.kfr@gmx.net>
Date2020-11-21 10:35 +0100
Message-ID<rpan1s$dgu$1@solani.org>
In reply to#4373
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.

[toc] | [prev] | [next] | [standalone]


#4375

FromChris Elvidge <chris@mshome.net>
Date2020-11-21 10:50 +0000
Message-ID<rparf2$cn3$1@dont-email.me>
In reply to#4374
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web