Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2347430
  • 博文数量: 609
  • 博客积分: 10061
  • 博客等级: 上将
  • 技术积分: 5920
  • 用 户 组: 普通用户
  • 注册时间: 2008-06-25 08:30
文章分类

全部博文(609)

文章存档

2010年(13)

2009年(39)

2008年(558)

我的朋友

分类:

2008-10-22 01:21:20

perl模拟windows的查找
 
#!usr/bin/perl
if ( $#ARGV<2 ) {
print<<"EOF";
输入参数不够,您输入的格式应该是:
perl $0 要搜索的字符串 搜索文件列表 记录文件
EOF
exit 0;
}
$string=shift;
$logfile=pop;
while(<>){
print "现在处理文件 $ARGV ... n" if ($currentFile ne $ARGV);
chomp($_);
foreach $word(split(/ /,$_)){
$couter++ if ($word eq $string);
}
$currentFile=$ARGV;
}
print "$string 出现的总次数是: $couter ";
open(FILE,">>$logfile");
print FILE "#"x30,"n";
print FILE "$string 出现的总次数是: $couter ";
close FILE
阅读(985) | 评论(0) | 转发(0) |
0

上一篇:wifi

下一篇:文件快速复制工具Fastcopy v1.80

给主人留下些什么吧!~~