开发者

Extract part of file name using KornShell

开发者 https://www.devze.com 2023-02-06 11:39 出处:网络
I have a file name, for example: xxdatafile_20110120123030_12342.dat. I want to extract \"XXdatafile_\" from the file name.

I have a file name, for example: xxdatafile_20110120123030_12342.dat. I want to extract "XXdatafile_" from the file name.

How do I do that u开发者_运维百科sing Ksh on Unix?


$ file=xxdatafile_20110120123030_12342.dat
$ echo ${file%%_*}
xxdatafile
0

精彩评论

暂无评论...
验证码 换一张
取 消