- 論壇徽章:
- 0
|
偶好好動(dòng)了下腦筋,寫了個(gè)
- #! /usr/bin/perl -w
- # read.pl
- use strict; use warnings;
- my $filename;
- if (!($filename=$ARGV[0])) {$filename = "Log.html"}
- open(FN,$filename)||die $!;
- my ($proj,$conf,$err,$warn);
- while(<FN>){
- if (/Project: (\w+), Configuration: (.*?)</){
- $proj="None" if !defined($proj=$1);
- $conf="None" if !defined($conf=$2);
- print "Project = ",$proj,"\nConfiguration = ",$conf,"\n";
- }
- if($proj && $_=~/$proj - (\d+) .*?(\d+)/){
- $err="None" if !defined($err=$1);
- $warn ="None" if !defined($warn=$2);
- print "error = ",$err,"\nwarning = ",$warn,"\n";
- }
- }
復(fù)制代碼
你試試看,運(yùn)行的時(shí)候,在shell下 ./read.pl Log.html
你的是linux嗎?
8好意思,剛才有錯(cuò),現(xiàn)在更正了,和89樓的一致了
[ 本帖最后由 perljoker 于 2007-9-25 17:28 編輯 ] |
|