Reputation: 1167
I need to log results from a file to the screen.
cat logfile.txt
=====================Installing Oracle========================
*** ERROR[Install023] Oracle is already installed in $VOL1.
Alert: There might be an issue, Please check!
=============================================
=====================File Set verification========================
Filesystem State 512-blocks Used Avail Capacity Mounted on
HOME STARTED 143372688 119516872 23855816 83% /home
BIN STOPPED - - - - /nfsT/nfsdata/common
ROOT STARTED 143372688 119516872 23855816 83% /
TEMP STARTED 143372688 118402344 24970344 83% /tmp
The Filset for home directory looks Ok.
The Filset for root directory looks Ok.
=============================================
I am doing:
perl -0777 -nle 'print $2 "\n" while m/^(={21})([\w\s]+)(+={24})/gm' logfile.txt
But it is not giving any result.
The out put needs to be.
Installing Oracle..... Alert
File Set verification.....Ok!
Upvotes: 0
Views: 89
Reputation: 241758
It's not clear what all the possible reasons for an alert could be, but the following works for your sample:
perl -ne 'undef $err, print "$1 ..." if /^={21}([^=]+)={24}/;
$err = 1 if /ERROR/;
print $err ? "Alert" : "Ok!", "\n" if /={45}/'
Upvotes: 1