Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个文件名,例如:xxdatafile_20110120123030_12342.dat. 我想"XXdatafile_"从文件名中提取。
xxdatafile_20110120123030_12342.dat
"XXdatafile_"
我如何在 Unix 上使用 Ksh 来做到这一点?
$ file=xxdatafile_20110120123030_12342.dat $ echo ${file%%_*} xxdatafile