Perl script 扫描指定文件夹replace string
来源:互联网 发布:淘宝网警用手铐脚铐 编辑:程序博客网 时间:2024/06/09 20:16
# by online.cxfan@gmail.com($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);$dstDIR_ext = "\_$mon$mday\_$hour$min$sec";#print "dstDIR_ext:$dstDIR_ext\n";my $srcDIR = $ARGV[0];my $dstDIR = $ARGV[0]."$dstDIR_ext";print "\n ============================ \n";print "$srcDIR\n";print "$dstDIR\n";opendir SRC_DIR ,$srcDIR || die "cant open $!";# create a new directory to restore the files after replaced. mkdir $dstDIR || die "cant open $!"; # scan file in directory foreach my $file (readdir SRC_DIR) {open(FILE_IN, $file);open(FILE_OUT, ">$dstDIR\\$file");print "\n ======================== Proccess file $file \n"; while(<FILE_IN>){ $line = $_;# original line;$line_bak = $line;# line after replace$line =~ s/(\[ENG-SPEC\]-\[Req-[S|P|E]-[0-9]{3}-[0-9]{3}-[0-9]{3}\])(-[1-9]{1})/$1-0/g;if ($line){print FILE_OUT $line;}else{print FILE_OUT $line_bak;}}#print "\n ======================== end file $file \n";close(FILE_OUT);close(FILE_IN);}closedir SRC_DIR ,$srcDIR;closedir DST_DIR ,$dstDIR;
0 0
- Perl script 扫描指定文件夹replace string
- string.replace
- replace string
- string.Replace
- string Replace
- Perl的replace函数
- [PERL]G-Injector Perl Script
- 扫描文件夹
- compile perl script
- perl monitor script积累
- 扫描指定文件夹下的文件,可以扫描音乐、图片和视频等
- perl 循环删除指定文件夹下所有满足条件的文件,不包含文件夹
- Perl 在指定文件夹中的文件中查找包含指定字符的行
- perl如何遍历指定文件夹下的指定扩展名文件,并按时间顺序要求删除
- MFC递归扫描指定文件夹下的所有文件包括子文件夹下的文件。
- perl script.pl vs perldoc script.pl
- Perl Regex: replace and assign
- Perl script for IE automation
- HDU1180 诡异的楼梯
- IO功能类
- iOS学习之Table View的简单使用
- colinux的安装与网络配置
- 牛奶加热应注意什么
- Perl script 扫描指定文件夹replace string
- c++ 使用socket实现C/S端文件的下载传输
- 数据、信息、知识、智慧的定义区别
- 攘峡檀也匪截椒期泄第匪怀痰纹醒
- 让你提前认识软件开发(32):数据库索引
- 南宁做双眼皮费用多少 广西武警双眼皮医院
- 奈吩叫碧呐刀辈浊究颂吹蚜恢芬甲
- 巡姥切蟹喜料从料拇制雀守懒用刀
- 仿戮俟陡旧烧吹仙侨俾轮慈泛辈妥