学海无涯 个人blog lnmps.com 新站
分类: LINUX
2013-03-11 20:01:29
1 | i=1 |
2 | for f in *.jpg; do |
3 | mv $f ${i}.jpg |
4 | ((i++)) |
5 | done |
1 | # 处理子目录文件 |
2 | find . -name '*.log' -type f | while read p; do |
3 | fname=$(basename $p) |
4 | # do some thing for fname |
5 | mv $p $(dirname $p)/$fname |
6 | done |
1 | for f in *.sc2replay; do mv $f ${f##*-}; done |
1 | for f in *; do |
2 | name=${f%.*} |
3 | ext=${f##*.} |
4 | mv $f `sed 's/e/x/g' <<< $name`.$ext |
5 | done |
1 | for f in *; do |
2 | name=${f%.*} |
3 | ext=${f##*.} |
4 | mv $f `tr 'a-z' 'A-Z' <<< $name`.$ext |
5 | done |