ITPub博客

首页 > 应用开发 > Java > shell script to rename directory

shell script to rename directory

原创 Java 作者:pentium 时间:2010-01-13 18:28:29 0 删除 编辑
substr in AWK to extract string[@more@]

#!/bin/bash
for file in *
do
showname=$file

if [ -d "$file" ] # Check if it's a directory.
then
# xxxx_report echo $showname | awk '{print substr($0,1,length($0)-7)}'
# cut ?only need xxxx
targetname=`echo $showname | awk '{print substr($0,1,length($0)-7)}'`
mv $showname $targetname
echo $file "has been changed"
fi

done

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/14377/viewspace-1030554/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: shell 字符串操作
下一篇: Rename Tablespace
请登录后发表评论 登录
全部评论

注册时间:2010-09-30

  • 博文量
    191
  • 访问量
    327263