<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Script error in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4208305#M325784</link>
    <description>B=$(awk -v DT="$DT" '$0 ~ DT { print NR; exit }'&lt;BR /&gt;&lt;BR /&gt;Oops, forgot the file:&lt;BR /&gt;B=$(awk -v DT="$DT" '$0 ~ DT { print NR; exit }' $ALR_LOG</description>
    <pubDate>Sun, 01 Jun 2008 05:25:00 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2008-06-01T05:25:00Z</dc:date>
    <item>
      <title>Script error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4208303#M325782</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I have created that script and when i executed this script i have soome error below i am mentioning the script as well as error.&lt;BR /&gt;&lt;BR /&gt;SR1&amp;gt; vi chkalert.sh&lt;BR /&gt;"chkalert.sh" 66 lines, 1143 characters&lt;BR /&gt;clear&lt;BR /&gt;# Script checks for ORA error in alert log file&lt;BR /&gt;# Error occured Post midnight&lt;BR /&gt;# Date : May 29 2008&lt;BR /&gt;&lt;BR /&gt;DT=`date '+%b %d'`&lt;BR /&gt;export DT&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;# Mention Alert file location&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;ALR_LOG=/ora9/home/dba/oracle/admin/mul/bdump&lt;BR /&gt;export ALR_LOG&lt;BR /&gt;&lt;BR /&gt;# echo $DT $ALR_LOG&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;# Count Total number of lines in log file&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;A=`wc -l $ALR_LOG|awk '{print \$1}'`&lt;BR /&gt;&lt;BR /&gt;# echo $A&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;# Find Line number when Today's first entry started in log file&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;B=`grep -n  "$DT" $ALR_LOG|head -1|awk -F: '{print \$1}'`&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;# Store total lines to be displayed from tail of log file by doing minus on A and B value&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;TAIL=`echo $A $B - p |dc`&lt;BR /&gt;&lt;BR /&gt;# echo $TAIL&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;# Display the ORA Error&lt;BR /&gt;#&lt;BR /&gt;echo&lt;BR /&gt;echo "################ Total ORA error Occurance Between Midnight and Now ############"&lt;BR /&gt;echo&lt;BR /&gt;tail -f $TAIL $ALR_LOG|awk '/^ORA/{print}'&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;echo&lt;BR /&gt;&lt;BR /&gt;echo "###### Display all distinct errrors ###########"&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;tail -f $TAIL $ALR_LOG|awk '/^ORA/{print}' |sort|uniq&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;# Alert when error is not from below List&lt;BR /&gt;#&lt;BR /&gt;&lt;BR /&gt;echo&lt;BR /&gt;echo "######## Alert when error is not from below List #############"&lt;BR /&gt;echo&lt;BR /&gt;echo " ORA -00060 "&lt;BR /&gt;echo " ORA-02396 "&lt;BR /&gt;echo&lt;BR /&gt;echo " ###################### - - - ##################### "&lt;BR /&gt;"chkalert.sh" 66 lines, 1141 characters&lt;BR /&gt;SR1&amp;gt;&lt;BR /&gt;SR1&amp;gt;&lt;BR /&gt;SR1&amp;gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;SR1&amp;gt; ./chkalert.sh&lt;BR /&gt;&lt;BR /&gt;################ Total ORA error Occurance Between Midnight and Now ############&lt;BR /&gt;&lt;BR /&gt;tail: Can only process one file at a time.&lt;BR /&gt;Usage: tail [-f] [-c number|-n number|-m number|-b number|-k number] [file]&lt;BR /&gt;Usage: tail [-r] [-n number] [file]&lt;BR /&gt;Usage: tail [+|-[number]][l|b|c|k|m][f] [file]&lt;BR /&gt;&lt;BR /&gt;###### Display all distinct errrors ###########&lt;BR /&gt;tail: Can only process one file at a time.&lt;BR /&gt;Usage: tail [-f] [-c number|-n number|-m number|-b number|-k number] [file]&lt;BR /&gt;Usage: tail [-r] [-n number] [file]&lt;BR /&gt;Usage: tail [+|-[number]][l|b|c|k|m][f] [file]&lt;BR /&gt;&lt;BR /&gt;######## Alert when error is not from below List #############&lt;BR /&gt;&lt;BR /&gt; ORA -00060&lt;BR /&gt; ORA-02396&lt;BR /&gt;&lt;BR /&gt; ###################### - - - #####################&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Please reply as soon as possible &lt;BR /&gt;regards,</description>
      <pubDate>Sun, 01 Jun 2008 04:52:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4208303#M325782</guid>
      <dc:creator>tayal_sumit</dc:creator>
      <dc:date>2008-06-01T04:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Script error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4208304#M325783</link>
      <description>&amp;gt;tail: Can only process one file at a time.&lt;BR /&gt;&lt;BR /&gt;To debug script errors you ask the commands to be echoed.  "set -x"&lt;BR /&gt;&lt;BR /&gt;In particular you should echo $TAIL.&lt;BR /&gt;&lt;BR /&gt;General comments on your script:&lt;BR /&gt;1) You should start with: #!/usr/bin/sh&lt;BR /&gt;2) export DT&lt;BR /&gt;No need to export local variables.&lt;BR /&gt;&lt;BR /&gt;3) Replace: A=`wc -l $ALR_LOG|awk '{print \$1}'`&lt;BR /&gt;A=$(wc -l &amp;lt; $ALR_LOG)&lt;BR /&gt;Note: You don't need a "\" before the "$" if inside ''.&lt;BR /&gt;&lt;BR /&gt;4) B=`grep -n "$DT" $ALR_LOG | head -1| awk -F: '{print \$1}'`&lt;BR /&gt;No need for that "\":&lt;BR /&gt;B=$(grep -n "$DT" $ALR_LOG | head -1| awk -F: '{print $1}')&lt;BR /&gt;You could do it all in awk:&lt;BR /&gt;B=$(awk -v DT="$DT" '$0 ~ DT { print NR; exit }'&lt;BR /&gt;&lt;BR /&gt;5) TAIL=`echo $A $B - p |dc`&lt;BR /&gt;No need for dc if your files are small.  And on 11.23, you don't need to worry:&lt;BR /&gt;TAIL=$(( A - B ))&lt;BR /&gt;&lt;BR /&gt;6) tail -f $TAIL $ALR_LOG|awk '/^ORA/{print}' |sort|uniq&lt;BR /&gt;grep will work fine here:&lt;BR /&gt;tail -f $TAIL $ALR_LOG | grep "^ORA" | sort -u</description>
      <pubDate>Sun, 01 Jun 2008 05:18:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4208304#M325783</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-06-01T05:18:31Z</dc:date>
    </item>
    <item>
      <title>Re: Script error</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4208305#M325784</link>
      <description>B=$(awk -v DT="$DT" '$0 ~ DT { print NR; exit }'&lt;BR /&gt;&lt;BR /&gt;Oops, forgot the file:&lt;BR /&gt;B=$(awk -v DT="$DT" '$0 ~ DT { print NR; exit }' $ALR_LOG</description>
      <pubDate>Sun, 01 Jun 2008 05:25:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/script-error/m-p/4208305#M325784</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-06-01T05:25:00Z</dc:date>
    </item>
  </channel>
</rss>

