T***B 发帖数: 137 | 1 I need to rename a bunch of files. The original file names would be like
these:
1254A.txt
23A.txt
89482A.txt
341A.txt
After renaming, the file names would be like:
1254B.txt
23B.txt
89482B.txt
341B.txt
In other words, the 'A' in the original file is replaces by 'B'. Is there any
easy way to do the renaming?
All the files are under a same directory.
Thanks. |
s***e 发帖数: 108 | 2 fi u have rename
rename A.txt B.txt *A.txt
【在 T***B 的大作中提到】 : I need to rename a bunch of files. The original file names would be like : these: : 1254A.txt : 23A.txt : 89482A.txt : 341A.txt : After renaming, the file names would be like: : 1254B.txt : 23B.txt : 89482B.txt
|
s**s 发帖数: 242 | 3 for i in $*
do
o=`echo $i|sed -e 's/A/B/'`
echo $i $o
mv $i $o
done
【在 T***B 的大作中提到】 : I need to rename a bunch of files. The original file names would be like : these: : 1254A.txt : 23A.txt : 89482A.txt : 341A.txt : After renaming, the file names would be like: : 1254B.txt : 23B.txt : 89482B.txt
|
T***B 发帖数: 137 | 4 Thanks, sngle and seis.
rename A.txt B.txt *A.txt works pretty well in my computer.
seis's way is a little complicated for a Cai Niao like me.
any
【在 s**s 的大作中提到】 : for i in $* : do : o=`echo $i|sed -e 's/A/B/'` : echo $i $o : mv $i $o : done
|
w*g 发帖数: 14 | 5 refer to 7426.
【在 T***B 的大作中提到】 : I need to rename a bunch of files. The original file names would be like : these: : 1254A.txt : 23A.txt : 89482A.txt : 341A.txt : After renaming, the file names would be like: : 1254B.txt : 23B.txt : 89482B.txt
|