Get the extension of file
This question already has an answer here:
You may use awk,
awk -F. '{print $NF}' file
or
sed,
$ echo 'info.tar.tbz2' | awk -F. '{print $NF}'
tbz2
$ echo 'info.tar.tbz2' | sed 's/.*.//'
tbz2
链接地址: http://www.djcxy.com/p/57092.html
上一篇: 删除所有文件扩展名
下一篇: 获取文件的扩展名