看看这个可以么?没在公司,不能测试
所在版块:技术の宅 发贴时间:2005-01-06 21:43  评分:

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
for example from *.abc to *.cde

source=`ls *.abc`
for file in $source
do
newfile=`echo $file | sed s'/.abc/.cde/g'`
#先不要用mv, 用echo看看$newfile名字对不,
#免得给你文件弄坏了
mv $file $newfile
done

.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

 相关帖子 我要回复↙ ↗回到正文
Shell programming problem (Borne Shell or Korn Shell) 香陵居士   (82 bytes , 553reads )
记得你好象曾经提起过有一个命令可以查当前是什么系统 JiuJie   (57 bytes , 194reads )
uname -a? 吴永铮   (0 bytes , 165reads )
谢谢 JiuJie   (0 bytes , 226reads )
看看这个可以么?没在公司,不能测试 JiuJie   (216 bytes , 239reads )
tested in Solaris 2.5 successfully. JiuJie   (175 bytes , 245reads )
not the most efficient one, since i am new to perl. but enough for your work MrDJay   (306 bytes , 235reads )
I mean shell script... :P 香陵居士   (26 bytes , 173reads )
.........u... MrDJay   (0 bytes , 147reads )
mv *.abc *.xyz 逃课专家   (0 bytes , 146reads )
please do not guess... 香陵居士   (93 bytes , 184reads )
for f in *.abc 逃课专家   (32 bytes , 166reads )
... 香陵居士   (0 bytes , 161reads )
man rename 吴永铮   (22 bytes , 185reads )
rename是函数吧,她要的应该是shell JiuJie   (0 bytes , 142reads )
看清楚,是RENAME(1),不是RENAME(2)。 吴永铮   (0 bytes , 135reads )
Can not find such command 香陵居士   (226 bytes , 187reads )
可能是linux专有的吧 吴永铮   (784 bytes , 249reads )
应该是的 SmellsLikeTeenSpirit   (0 bytes , 181reads )