How to add filter some ORA- errors in the below script:
======================================================
use File::Basename; $lp=$ARGV[0]; $regex=$ARGV[1]; $er_mes="Message: Check arguments: \"logfile_path\" \"regex\"."; $ws="Statistic:"; $wm="Message:"; $name = basename $lp; sub chk_var { if ($_[0] eq '') { print "$er_mes\n"; exit 1; } } sub out_res { print "Statistic: $_[0]\n"; print "Message: $_[1]\n"; exit 0; } chk_var($lp); chk_var($regex); unless (-e $lp) { print "$wm File $lp not found.\n"; exit 1; } $search=$regex; $search=~ s/[^a-zA-Z0-9]*//g; $fp='/tmp/new'.'_'.${name}.'_'.${search}; if (-e "$fp") { open (TF, $fp); while (<TF>) { chomp; $kr=$_; } close (TF); } else { $kr=0; } open (LF, $lp); my @lf = <LF>; close (LF); $i=0; $pos=1; $t=0; foreach $l (@lf) { chomp $l; if ($l =~ /$regex/) { $resl[$i]=$l; $resn[$i]=$pos; $i++; $t++; } $pos++; } if ($t lt $kr) { $kr=0; } $temp=$t-$kr; $kr=$temp+$kr; open (TF, ">$fp"); print TF "$kr\n"; close TF; $length=@resl; $limit=$length-1-$temp; if ($temp ne 0) { for ($i=$length-1;$i>$limit;$i--) { $l=$resl[$i]; $str.="<br/>"; $str.=$l; $str.=";"; } print "$ws $temp\n"; print "$wm Number of newly found string: $temp. Lines that have search + string: $str\n"; exit 0; } else { print "$ws $temp\n"; print "$wm No new strings found.\n"; exit 0; }

2017-12-05 Athanasius added code tags


In reply to adding filter to perl script by nmm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.