两个shell脚本
来源:互联网 发布:dorado js 获取登录人 编辑:程序博客网 时间:2024/05/06 18:45
转自http://xiujie.5d6d.com/thread-2985-1-1.html
Shell 文件名大小写转换
shell判断文件,目录是否存在或者具有权限
在unix系统下经常要碰到改文件名,如果是改单个文件则好处理,但要是批量改文件名则工作量很大,必须运用shell程序来实现,以下程序就是通过shell来实现批量更改日志文件名的程序,大家可以稍作修改,就可以实现批更改你所需要更改的文件名。
以下就为程序内容,可供大家学习参考:
STR="请选择:"
DATE="请输入日期(031001):"
while true
echo "1) 批更改文件名"
echo "0) 退出/n"
printf $STR
read anwser
do
case $anwser in
1)
printf $DATE
read ndate
file1='C'$ndate'.*'
#定义FILE1为C打头的带日期的所有文件
#echo $file1
ls $file1 > test.txt
out1=`more test.txt|awk '{print $1}'`
number=`more test.txt|wc -l`
i=1
echo "number = " $number
while true
do
put1=`echo $out1|awk '{print $'$i'}'`
put2=`echo $out1|awk '{print substr($'$i',2,10)}'`
put2='20'$put2
echo $put1
echo $put2
mv $put1 $put2
i=`expr $i + 1`
if [ $i -gt $number ]
then
break
fi
done
echo "批更改文件成功!/n"
;;
0)
exit
;;
esac
done
- 两个shell脚本
- shell脚本比较两个文件夹
- 两个shell备份mysql的脚本
- 两个处理文件的shell脚本
- 脚本分享-两个shell备份mysql的脚本
- 在两个日期间循环的shell脚本
- shell脚本下比较两个数的大小
- shell脚本查找两个文件夹下相同的文件名
- 用shell脚本,指定两个日期,计算相隔天数
- 【脚本】linux shell 如何比较两个整数的大小
- shell脚本编写比较两个数的大小
- shell脚本——比较两个文件大小、权限
- 实现两个文件内容逐行进行对比的shell脚本
- 编写一个Shell脚本,脚本中定义两个函数fun1和fun2
- shell脚本
- shell脚本
- shell脚本
- shell脚本
- EL表达式详解
- dev 笔记
- 程序员应知——数据库设计的两个误区
- Ubuntu与windows的双启动设置
- servlet编写和配置
- 两个shell脚本
- 数据库级MD5
- 天气热及学习法语二三事。。
- Oracle锁的学习
- 『数据结构』图的遍历和生成树求
- 放暑假了
- dev xGridControl Cell添加图片
- dev xGridControl Cell添加图片
- IT工程师必看的十条建议(转载)