avatar
a question about rename# Unix - 噫吁兮,危乎高哉
T*B
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.
avatar
s*e
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

avatar
s*s
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

avatar
T*B
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

avatar
w*g
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

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。