![]() |
Helloやアメリカ合衆国へようこそ! UNIXおよびLinuxフォーラム!訪問し、当社のグローバルコミュニティに参加いただきありがとうございます。
|
|
Googleのunix.com
|
|||||||
| シェルプログラミングとスクリプティング KSH 、 CSH 、 shに、 bashの、はPerl 、 PHPは、削除するsed 、 Awkの、他のシェルスクリプトやシェルスクリプト言語についての質問の投稿はこちら。 |
その他のUNIXおよびLinuxフォーラムトピックは参考にすること
|
||||
| スレッド | スレッドスターター | フォーラム | 返信 | 最後の投稿 |
| perlスクリプトの出力でエラー | namishtiwari | シェルプログラミングとスクリプティング | 2 | 2009年6月15日 05:02午前 |
| 間違ったコマンドの出力トランジスタを与える | ushaラオ | シェルプログラミングとスクリプティング | 8 | 2009年5月8日 07:13午前 |
| 並べ替え間違ったコマンドの出力を与える | ushaラオ | シェルプログラミングとスクリプティング | 8 | 2009年4月7日 08:54午前 |
| Perlのスクリプトの問題。何がおかしいのですか? | SkySmart | シェルプログラミングとスクリプティング | 14 | 2009年3月19日 05:22午後 |
| 印刷サビン-出力のサイズ間違っ | h1timmboy | AIX | 2 | 2006年2月28日 09:19午前 |
|
|
LinkBack | スレッドツール | このスレッドを検索 | スレッドを評価 | 表示モード |
|
||||
|
perlのスクリプトの中で間違って出力
やあ、
ここのコードを自分の作品です- コード:
#!/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;
}
}
}
}
}
コード:
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 コード:
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... 親切whaここに間違っていることをお勧めします。 |