Filename from pathname excluding (unknown) extension
0
votes
3
answers
304
views
Having a [pathname](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_267) it is possible to extract its [filename](http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_170) , excluding its _apriori_ known extension, with [basename](https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_40) :
$ pathname="/home/paulo/paulo.pdf"
$ printf "%s\n" "$(basename $pathname .pdf)"
paulo
But if the extension is not known how can this be done?
Asked by Paulo Tomé
(3832 rep)
Feb 10, 2020, 12:53 PM
Last activity: Feb 10, 2020, 07:44 PM
Last activity: Feb 10, 2020, 07:44 PM