linux 批更改文件名
文件夹A下100个文件,每个文件名字是
hello+***+nice.txt,
aa+***+kk.txt
.......
(***)是任意的字符串
我现在想把文件名改成***.txt该怎么作呢?
我使用cut -f 2 -d "+"能得到***,可是我该怎么能把文件名改成***.txt呢
------解决方案--------------------
Assembly code
for file in *.txt; do
newname=`echo $file | awk -F+ '{print $2".txt"}'`
mv $file $newname
done