分类: LINUX
2013-03-16 09:40:06
91040 100991041 100991042 100991043 100991044 100991045 100991046 100991047 100991048 100991049 100991050 100991051 100991052 100991053 100991054 100991234 1
00991235 100991427 100991428 100991429 100991430 100991431 100991432 100991433 100991434 100991523
5 215 0 0 18026457 10523131 1 0 0 0 0 0 0 0 0
6 226 0 0 17468441 10239837 0 0 0 0 0 0 0 0 0
1 161 0 0 15004024 8841928 0 0 0 0 0 0 0 0 0
142 0 0 17955088 10441777 0 0 0 0 0 0 0 0 0
#################################################3
#!/bin/perl
my $InputFile=@ARGV[0]; #source File Name
my $DataDir=@ARGV[1]; #the Directory for data File save
my $necode=@ARGV[2];
@s;
@m;
my $tmp="";
my $j=0;
die("can not open file \"$inPutFile\"")unless(open(HWSOURCEFILE,$InputFile));
while ($line=
$line=DeleteEndNewLineCharacter($line);
if ($line =~ /^
$line = &GetProperties($line,"measInfoId");
$tmp=$line;
if ($DataDir !~ /\/$/) {
$DataDir=$DataDir."/";
}
#print $DataDir;
#print $line;
}
elsif ($line =~ /^
$line = &GetProperties($line,"endTime");
$line = substr($line,0,index($line,"+"));
$line =~ s/T/ /g;
$line = &strTrim($line);
$endtime=$line;
}
elsif ($line =~ /
$line = &GetProperties($line,"measObjLdn");
#$line = substr($line,0,index($line,"+"));
#$line =~ s/\//\t/g;
$line = &strTrim($line);
$measObjLdn=$line;
}
elsif($line =~ /^
{
my $result2 = (split(">",$line))[1];
$result2 = (split("<",$result2))[0];
$result2 = &strTrim($result2);
$result2 =~ s/ / /g;
$result2 =~ s/NIL//g;
@s=split/\s+/,$result2;
$filename2=$DataDir.$tmp."-measTypes.txt";
print "***".$filename2."***";
open(fhn2,">>$filename2")|| die $!;
unshift(@s,"measObjLdn");
unshift(@s,"endtime");
unshift(@s,"number");
while(@s)
{
$value2=shift(@s);
print fhn2 ("$value2\t");
}
close(fhn2);
}
elsif ($line =~ /^
my $result = (split(">",$line))[1];
$result = (split("<",$result))[0];
$result = &strTrim($result);
$result =~ s/ / /g;
$result =~ s/NIL//g;
#print "[$result]\n";
@m=split/\x20/,$result;
$filename=$DataDir.$tmp."-measResults.txt";
print "***".$filename."***";
open(fhn1,">>$filename")|| die $!;
while(@m)
{
$j++;
$value=shift(@m);
print fhn1 ("$j\t$endtime\t$necode\t$measObjLdn\t$value");
unless(@m)
{
print fhn1 ("\n");
last;
}
}
close(fnn1);
}
elsif ($line =~ /^<\/measInfo/){
$j=0;
}
}
#Get Tags Properties
sub GetProperties {
my($content,$subsybol) = @_;
$content = (split($subsybol,$content))[1];
$content = (split("\"",$content))[1];
$content = (split("\"",$content))[0];
return $content;
}
#delete ^M charterect
sub DeleteEndNewLineCharacter{
my ($content)=@_;
$content=substr($content,0,length($content)-1);
$content=strTrim($content);
return $content;
}
#delete space
sub strTrim {
my ($content)=@_;
$content=~s/^[ ]+|[ ]+$//g;
return $content;
}
¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥¥