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.
这些文件有一个共同的模式。
feed_predict.data.4.202.0 feed_predict.mdl.4.202.0 feed_predict.so.4.202.0 feed_predict.xml.4.202.0
我想批量移动文件。
for x in feed_predict{.*}4.202.0; //ls $x //nothing prints here sudo mv $x $1.4.17.0; end
但是 $x 在这里是空的。
您可以使用带有旧后缀的basename将其从文件名中剥离,然后将其与新后缀连接:
for x in feed_predict.*.4.202.0; sudo mv $x (basename $x .4.202.0).4.17.0 end