The UNIX and Linux Forums  
Hello and Welcome-tól az Egyesült Államokat, hogy az UNIX és Linux Forums? Köszönjük, hogy meglátogatta és csatlakozik Globális Közösség.

Go Back   A UNIX és Linux Forums > Top Fórumok > Shell programozás és Scripting
.
google unix.com



Shell programozás és Scripting Post kérdések KSH, CSH, SH, Bash, Perl, PHP, SED, AWK ÉS EGYÉB shell szkriptek és shell script nyelvek itt.

Több, UNIX és Linux fórum témák Ön által talált Hasznos
Szál Thread Starter Fórum Válaszok Utolsó hozzászólás
hiba a kimeneti perl script namishtiwari Shell programozás és Scripting 2 06-15-2009 05:02 AM
tr parancs, amely rossz teljesítmény Usha rao Shell programozás és Scripting 8 05-08-2009 07:13 AM
Rendezés parancsot, hogy rossz teljesítmény Usha rao Shell programozás és Scripting 8 04-07-2009 08:54 AM
Perl Script kérdés. Mit csinálok rosszul? SkySmart Shell programozás és Scripting 14 03-19-2009 05:22 PM
Nyomtatás a Savin - mérete kimenet rossz h1timmboy AIX 2 02-28-2006 09:19 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Téma eszközök Keresés a téma Rate Thread Megjelenítési módok
  #1 (permalink)  
Old 07-02-2009
namishtiwari namishtiwari is offline Forum Advisor  
Regisztrált felhasználó
  
 

Join Date: Aug 2007
Helyszín: Bangalore
Hozzászólások: 377
rossz teljesítmény a perl script

Szia,

Itt van a kis-kód --

Kód:
#!/usr/bin/perl

my $Time_Stamp ;
my $User_Name;
my $Success;
my $Failure;
my $ErrorCode;
my $ErrorMsg;
my $logDir = $ARGV[0]; 
my $logPrefix = $ARGV[1]; 

die "usage: $0 <logDir> <logPrefix>" unless $logDir and $logPrefix;  
die "Log dir $logDir doesn't exist" unless -d "$logDir";  
for my $logFile ( glob("$logDir/${logPrefix}*") ) 
{ 
	open($log, "<", $logFile) or die "Can't open $logFile for reading.";
	open(FP_OUT,">temp12") or die "cannot create file temp1 for writing";
	print "Processing file $logFile...\n";
	

	OUTER: while( $line = <$log> )
	{

		 chomp($line);
		 if ($line =~ /^(.*)INFO:.*QNA Step - AUTH IN PROGRESS/) 
		 {
				$Time_Stamp = $1;
				printf FP_OUT "$Time_Stamp,";
				QnA_search_for_sucess_or_failure() ;
				#QnA_search_for_userID() ;
				next OUTER;

		 }

	 }
}

 


sub QnA_search_for_sucess_or_failure
 
{
OUTER1: while ( $line = <$log> )

{
	  if ($line =~ /QNA Auth.*Success\s*and\s*Complete/)

	   {
				printf FP_OUT "Success,";
				print STDOUT  "In Success,\n";
				$ErrorMsg="null";
				while ( $line = <$log> )
				{
					 if ($line =~ /ArAuthFrameworkImpl::doPostAuth.*Authentication\s*mechanism\s*returned\s*\[(..*)\]\s*for\s*AuthIdentity\s*\[(..*)\]/)

						 {
							   print "$2\n";
							  printf FP_OUT "$2, ${1}, $ErrorMsg\n";
							  last OUTER1;

						 }
				 }
				 
	   }
	   if($line =~ /Message.*QNA\s*Auth\s*Failed\((..*)\).*/)
	   {
				 $ErrorMsg=$1;
				 printf FP_OUT  "Failure,";
				 print STDOUT  "In Failure,\n";
				 while ( $line = <$log> )
					  {
						 if ($line =~ /ArAuthFrameworkImpl::doPostAuth.*Authentication\s*mechanism\s*returned\s*\[(..*)\]\s*for\s*AuthIdentity\s*\[(..*)\]/)

						  {
							  
							  print "$2\n";
							  printf FP_OUT "$2, ${1}, $ErrorMsg\n";
							  last OUTER1;
						  }

					  }

				 
	   }
	  }
	  
}
Az alábbi részlet, amelyet a logfile.I használok míg hurkokon mert sok vonal felett és inbetween ezt a darabot.
Kód:
Tue May 19 22:55:13.649 2009 Morocco Standard Time INFO:    pid 2172 tid 3412: 160: 10083504: QNA Step - AUTH IN PROGRESS
Tue May 19 22:55:13.649 2009 Morocco Standard Time INFO:    pid 2172 tid 3412: 160: 10083504: QNA Auth - Success and Complete, Returning SUCCESS
Tue May 19 22:55:13.665 2009 Morocco Standard Time INFO:    pid 2172 tid 3412: 17: 10083504: ArAuthFrameworkImpl::doPostAuth::1:10083487:: Authentication mechanism returned [0] for AuthIdentity [12345]


and for QnA failure the line comes like this in place of success line--
Tue May 19 22:56:21.962 2009 Morocco Standard Time INFO:    pid 2172 tid 688: 160: 10083554: Err[115261735], Message: QNA Auth Failed(Invalid Credentials), Repeating the challenge and Returning FAILED
mikor futott a program, mint ez --
Kód:
C:\Perl Script>perl  QnA_Authentication.pl . logfile.txt
Processing file ./logfile.txt...
In Success,
01503164
In Success,
01822755
In Failure,
01401058
Processing file ./logfile.txt.bak...
de a kimeneti fájl, ami temp12, nem nyomdai semmit.
Kedves arra utalnak, mi nem stimmel itt.
 

Könyvjelzõk

Téma eszközök Keresés a téma
Keresés a téma:

Részletes keresés
Megjelenítési módok Rate this thread
Rate this thread:

Posting szabályzat
Ön nem post new threads
Ön nem post válaszok
Ön nem post Csatolmányok
Ön nem szerkeszteni az üzeneteidet

BB kód van Be
Smilies vannak Be
[IMG] kód Be
HTML kód Ki
Trackbacks vannak Be
Pingbacks vannak Be
Refbacks vannak Be




Minden idő GMT -4. Az idő most 11:12 AM.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Limited. Nyelvre lefordítva Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
A UNIX és Linux Fórum Tartalom Copyright © 1993-2009. Minden jog Reserved.Ad menedzsment RedTyger

Content Relevant URLs by vBSEO 3.2.0