Regex Perl-Oneliner正则表达式
我需要将结果从一个文件记录到屏幕上 cat logfile.txtRegex Perl-Oneliner正则表达式,regex,perl,file,Regex,Perl,File,我需要将结果从一个文件记录到屏幕上 cat logfile.txt =====================Installing Oracle======================== *** ERROR[Install023] Oracle is already installed in $VOL1. Alert: There might be an issue, Please check! ============================================= =
=====================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.
=============================================
我正在做:
perl -0777 -nle 'print $2 "\n" while m/^(={21})([\w\s]+)(+={24})/gm' logfile.txt
但这并没有带来任何结果
我们需要把它弄出来
Installing Oracle..... Alert
File Set verification.....Ok!
不清楚警报的所有可能原因是什么,但以下内容适用于您的示例:
perl -ne 'undef $err, print "$1 ..." if /^={21}([^=]+)={24}/;
$err = 1 if /ERROR/;
print $err ? "Alert" : "Ok!", "\n" if /={45}/'
perl-0777-wnle…