linux – 在扩展名之前获取文件名

前端之家收集整理的这篇文章主要介绍了linux – 在扩展名之前获取文件名前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在同一目录(在UNIX文件系统中)有一些文件,如下所示:
  1. a.txt.name
  2. b.xml.name
  3. c.properties.name
  4.  
  5. a.txt.name2
  6. b.xml.name2
  7. c.properties.name2

如何使用一些shell命令在名称名称2部分之前获取字符串?

即. a.txt,b.xml,c.properties部分?

解决方法

  1. $basename a.txt.name .name
  2. a.txt

猜你在找的Linux相关文章