我在同一目录(在 UNIX 文件系统中)中有一些文件如下所示:
a.txt.name
b.xml.name
c.properties.name
a.txt.name2
b.xml.name2
c.properties.name2
如何使用某些 shell 命令获取 name
或 name2
部分之前的字符串?
即。 a.txt
、b.xml
、c.properties
部分?
最佳答案
$ basename a.txt.name .name
a.txt
关于linux - 获取扩展名前的文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2767161/