- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Perl solution for reading multi lines error search...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2010 03:22 AM
тАО06-21-2010 03:22 AM
I need to consolidate a reconcillation file based on errors received from standard oracle SQL*Loader log file. In case of SQL*Loader logfile, the error message for single rejected record is spawned as 5 error messages. For example, rejected record 10 appears as
Record 10: Rejected - Error on table "CFSOWNER"."SUA_MT", column FEES_AMT_IND.
ORA-01400: cannot insert NULL into (FEES_AMT_IND)
SQL*Loader-522: lfiopn failed for file (/transfer/linktest/estath/scripts/ods/loader/bad/LOADED_ASFGH.DAT.bad.1)
SQL*Loader-552: insufficient privilege to open file
SQL*Loader-509: System error: Permission denied
SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
Based on SQL*Loader error logfile, I want to generate a short version reconcillation information that would give me info like
Record10|ORA-01400: cannot insert NULL into (FEES_AMT_IND)|
Record15|
Please note that I am interested only on ORA- error and not on SQL*Loader error.
Another level of information is I should be able to scan record 10 in LOADED_ASFGH.DAT and get the first 15 characters in the feedfile in a loop.
So output should be like.
Record10|ORA-01400: cannot insert NULL into (FEES_AMT_IND)|
records are like
111465550005060 30/04/20100000000001003 UKP 29632.99
Thanks,
Srikanth A
Solved! Go to Solution.
- Tags:
- Perl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2010 03:56 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2010 04:43 AM
тАО06-21-2010 04:43 AM
Re: Perl solution for reading multi lines error search pattern
As requested I am attaching the feed file and logfile to be scanned and generate a output file. Please advice.
Thanks,
Srikanth Arunachalam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2010 04:44 AM
тАО06-21-2010 04:44 AM
Re: Perl solution for reading multi lines error search pattern
Sorry to have missed the feedfile.
Thanks,
Srikanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2010 06:45 AM
тАО06-21-2010 06:45 AM
Re: Perl solution for reading multi lines error search pattern
Based on your data, you could do:
# cat ./myfilter
#!/usr/bin/perl
use strict;
use warnings;
my ( @pieces, $line );
{
local $/ = undef;
@pieces = split( /(?=Record\s+\d+:)/, <> );
}
for $line (@pieces) {
if ( $line =~ m{(Record\s+\d+).+?(ORA.+?)SQL}s ) {
print "$1|$2";
}
}
1;
# ./myfilter mylog
Record 10|ORA-01400: cannot insert NULL into (FEES_AMT_IND)
Record 15|ORA-01400: cannot insert NULL into (FEES_AMT_IND)
Record 21|ORA-01400: cannot insert NULL into (FEES_AMT_IND)
As for the second part of your question, does "...scan record 10..." simply mean "read record #10" and append the first 15-characters to the above output?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2010 07:11 AM
тАО06-21-2010 07:11 AM
Re: Perl solution for reading multi lines error search pattern
I am going to assume that for the second part of your question, does "...scan record 10..." simply mean "read record #10" and append the first 15-characters to the above output. If so, overall, you might do:
# cat ./myfilter
#!/usr/bin/perl
use strict;
use warnings;
my ( @pieces, $line, @lookup );
{
my $feedfile = '/tmp/myfeed';
open( my $fh, '<', $feedfile ) or die "Can't open '$feedfile': $!\n";
while (<$fh>) {
chomp;
push( @lookup, substr( $_, 0, 14 ) );
}
}
{
local $/ = undef;
@pieces = split( /(?=Record\s+\d+:)/, <> );
}
for $line (@pieces) {
if ( $line =~ m{(Record\s+(\d+)).+?(ORA.+?)\sSQL}s ) {
print $1, "|", $3, "|", $lookup[ $2 - 1 ], "\n";
}
}
1;
# ./myfilter mylog
Record 10|ORA-01400: cannot insert NULL into (FEES_AMT_IND)|11465550005060
Record 15|ORA-01400: cannot insert NULL into (FEES_AMT_IND)|11465550005060
Record 21|ORA-01400: cannot insert NULL into (FEES_AMT_IND)|11465550005060
Please note that I hard-coded the name for the "feeder" data. You can embellish this as needed.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2010 07:13 AM
тАО06-21-2010 07:13 AM
Re: Perl solution for reading multi lines error search pattern
Thank you very much. I got exactly what is expected. Many many thanks for your help as usual. You have been a good mentor for honing my perl skills.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-21-2010 08:55 AM
тАО06-21-2010 08:55 AM