<?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: Tail alternative in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147209#M900136</link>
    <description>Thanks guys!&lt;BR /&gt;&lt;BR /&gt;It works better now.&lt;BR /&gt;</description>
    <pubDate>Fri, 19 Dec 2003 16:49:11 GMT</pubDate>
    <dc:creator>dude70_1</dc:creator>
    <dc:date>2003-12-19T16:49:11Z</dc:date>
    <item>
      <title>Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147192#M900117</link>
      <description>Hi Guys!&lt;BR /&gt;&lt;BR /&gt;I am trying to change the  monitoring ksh script into perl script. Can this be converted in perl script? Also Is it possible to mix perl script and shell script as one script?&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;**********&lt;BR /&gt;tail -f log.txt | while read LINE&lt;BR /&gt;do&lt;BR /&gt;var= `echo $LINE | grep "Error Occured"`&lt;BR /&gt;echo $var&lt;BR /&gt;done&lt;BR /&gt;**************&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The reason being tail -f sleeps for one second according to the UNIX man pages! Sometimes the log file may be appended with lots of lines So tail is doing it very slow. It puts things in buffer and works very slow on that. I heard perl is a best alternative!&lt;BR /&gt;&lt;BR /&gt;Thanks.  &lt;BR /&gt;</description>
      <pubDate>Wed, 17 Dec 2003 11:00:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147192#M900117</guid>
      <dc:creator>dude70_1</dc:creator>
      <dc:date>2003-12-17T11:00:03Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147193#M900120</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;that shouldnt matter. Most important thing is, that it doesnt miss any data. Do you have proof, that it misses data? You can of course put perl commands into the ksh script.&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Dec 2003 11:13:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147193#M900120</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-17T11:13:31Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147194#M900121</link>
      <description>Hi Mike,&lt;BR /&gt;&lt;BR /&gt;Thanks for the reply. I don't see that missing any data. My log files are dumped with enormous data. After determining the error I have to do lots of operations. So I am wondering any other thing will improve the speed!&lt;BR /&gt;&lt;BR /&gt;Thanks again!</description>
      <pubDate>Wed, 17 Dec 2003 11:29:03 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147194#M900121</guid>
      <dc:creator>dude70_1</dc:creator>
      <dc:date>2003-12-17T11:29:03Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147195#M900122</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;In this use tail is just looking at the last 10 lines once each second so increase the number of lines that it looks at until you feel that you are looking far enough back into the file to catch all errors.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;**********&lt;BR /&gt;tail -n NN -f log.txt | while read LINE&lt;BR /&gt;do&lt;BR /&gt;var= `echo $LINE | grep "Error Occured"`&lt;BR /&gt;echo $var&lt;BR /&gt;done&lt;BR /&gt;**************&lt;BR /&gt;NN = number of lines to look at&lt;BR /&gt;&lt;BR /&gt;so for 50 lines:- &lt;BR /&gt;&lt;BR /&gt;**********&lt;BR /&gt;tail -n 50 -f log.txt | while read LINE&lt;BR /&gt;do&lt;BR /&gt;var= `echo $LINE | grep "Error Occured"`&lt;BR /&gt;echo $var&lt;BR /&gt;done&lt;BR /&gt;**************&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Paula&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Dec 2003 11:34:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147195#M900122</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2003-12-17T11:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147196#M900123</link>
      <description>Hi Paula,&lt;BR /&gt;&lt;BR /&gt;if there are so many data written into the log, your approach will miss information, plus you will have to run it each time new.&lt;BR /&gt;&lt;BR /&gt;Hi Dude70,&lt;BR /&gt;&lt;BR /&gt;can you make a more precise search for the grep, so you get less lines?&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Dec 2003 11:38:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147196#M900123</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-17T11:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147197#M900124</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;An option is the grep out all errors and store them in an error log and then use the tail routine on that.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Collect so:-&lt;BR /&gt;&lt;BR /&gt;**********&lt;BR /&gt;cat log.txt | while read LINE&lt;BR /&gt;do&lt;BR /&gt;echo $LINE | grep "Error Occured" &amp;gt; errorlog.txt&lt;BR /&gt;done&lt;BR /&gt;**************&lt;BR /&gt;&lt;BR /&gt;View so:-&lt;BR /&gt;&lt;BR /&gt;then either cat or tail -n NN errorlog.txt&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Wed, 17 Dec 2003 11:41:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147197#M900124</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2003-12-17T11:41:12Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147198#M900125</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm not sure that tail if the problem ... It goes in the 1s loop ONLY if there is not data available, so in case of many lines comming suddenly they will be immediatly displayed. But perhaps it's the application which bufferize its output ? Sometimes a fflush() in a C program can improve ...&lt;BR /&gt;&lt;BR /&gt;Regards.</description>
      <pubDate>Wed, 17 Dec 2003 11:55:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147198#M900125</guid>
      <dc:creator>Jean-Louis Phelix</dc:creator>
      <dc:date>2003-12-17T11:55:05Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147199#M900126</link>
      <description>Hi Mike,&lt;BR /&gt;&lt;BR /&gt;I have lots of data apart from "Error Occured" string written to the log. I have to look for this particular string. If this happens then I have to add following 5 lines which describes the error data and process them. Paula's approach will be good if I have only one line/one file. In contrast I have zillon files and too much of data! I was wondering whether perl will do a better job. Now I am also working for C and java alternatives!&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Wed, 17 Dec 2003 11:55:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147199#M900126</guid>
      <dc:creator>dude70_1</dc:creator>
      <dc:date>2003-12-17T11:55:33Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147200#M900127</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;try this:&lt;BR /&gt;tail -f log.txt | while read LINE&lt;BR /&gt;do&lt;BR /&gt;  if test `echo $LINE | grep "Error Occured" | wc -l` -gt 0&lt;BR /&gt;  then&lt;BR /&gt;    echo ${LINE}&lt;BR /&gt;    read LINE&lt;BR /&gt;    echo ${LINE}&lt;BR /&gt;    read LINE&lt;BR /&gt;    echo ${LINE}&lt;BR /&gt;    read LINE&lt;BR /&gt;    echo ${LINE}&lt;BR /&gt;    read LINE&lt;BR /&gt;    echo ${LINE}&lt;BR /&gt;    read LINE&lt;BR /&gt;    echo ${LINE}&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Dec 2003 12:00:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147200#M900127</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-17T12:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147201#M900128</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;forgot the fi before the done!&lt;BR /&gt;&lt;BR /&gt;Michael&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Dec 2003 12:01:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147201#M900128</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-17T12:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147202#M900129</link>
      <description>tail -f log.txt | awk '/Error Occured/ {print; for (i=1;i&amp;lt;=4;i++) {getline;print}} '&lt;BR /&gt;&lt;BR /&gt;-- Graham</description>
      <pubDate>Wed, 17 Dec 2003 12:08:38 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147202#M900129</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-12-17T12:08:38Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147203#M900130</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;Have a t look at swatch:-&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://ciac.llnl.gov/ciac/ToolsUnixSysMon.html#Swatch" target="_blank"&gt;http://ciac.llnl.gov/ciac/ToolsUnixSysMon.html#Swatch&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Paula</description>
      <pubDate>Wed, 17 Dec 2003 12:11:23 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147203#M900130</guid>
      <dc:creator>Paula J Frazer-Campbell</dc:creator>
      <dc:date>2003-12-17T12:11:23Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147204#M900131</link>
      <description>Thanks guys,&lt;BR /&gt;&lt;BR /&gt;I'll post the results after testign these!&lt;BR /&gt;&lt;BR /&gt;Cheers!</description>
      <pubDate>Wed, 17 Dec 2003 12:27:15 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147204#M900131</guid>
      <dc:creator>dude70_1</dc:creator>
      <dc:date>2003-12-17T12:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147205#M900132</link>
      <description>Hi Mike and Graham,&lt;BR /&gt;&lt;BR /&gt;Can you explain what exactly your code does?&lt;BR /&gt;&lt;BR /&gt;Thanks!</description>
      <pubDate>Wed, 17 Dec 2003 12:36:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147205#M900132</guid>
      <dc:creator>dude70_1</dc:creator>
      <dc:date>2003-12-17T12:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147206#M900133</link>
      <description>Hi Dude70,&lt;BR /&gt;&lt;BR /&gt;my script is looking for the error text "Error Occured" prints it and the next five lines following it, as you requested.&lt;BR /&gt;&lt;BR /&gt;greetings,&lt;BR /&gt;&lt;BR /&gt;michael&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Dec 2003 16:35:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147206#M900133</guid>
      <dc:creator>Michael Schulte zur Sur</dc:creator>
      <dc:date>2003-12-17T16:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147207#M900134</link>
      <description>Dude&lt;BR /&gt;&lt;BR /&gt;My contribution is in 2 parts.&lt;BR /&gt;&lt;BR /&gt;The tail -f part I think you know already.&lt;BR /&gt;The awk script does nothing until it finds the string "Error Occured" (BTW - is this spelled correctly). &lt;BR /&gt;Then the solitary "print" prints the current line.&lt;BR /&gt;Then the for loop reads in 4 more lines and prints them.&lt;BR /&gt;Then it waits for another occurence of the string.&lt;BR /&gt;&lt;BR /&gt;The general format of an awk script is a collection of &lt;BR /&gt;  pattern { action }&lt;BR /&gt;statements, so in this case pattern is "Error Occured" and action is everything between the outside braces.&lt;BR /&gt;&lt;BR /&gt;Hope this helps.&lt;BR /&gt;&lt;BR /&gt;-- Graham&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Dec 2003 03:16:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147207#M900134</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-12-18T03:16:20Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147208#M900135</link>
      <description>The problem here is that if you don't do what "tail" does you could potentially cripple the machine.  You have to sleep!&lt;BR /&gt; &lt;BR /&gt;The alternative is for your script to open syslog and read from it, If there is nothing to read, it will hang until there is somethign else to read.  This sounds great but will kill the performance of the machine.&lt;BR /&gt; &lt;BR /&gt;Try this to see what I mean.&lt;BR /&gt; &lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;&lt;BR /&gt;open SYSLOG,"&lt;BR /&gt;while (1){&lt;BR /&gt;        $i=&lt;SYSLOG&gt;;&lt;BR /&gt;        if($i=~/Error Occured/){&lt;BR /&gt;                print "Oh dear, we got another error $i";&lt;BR /&gt;&lt;BR /&gt;        }&lt;BR /&gt;}&lt;BR /&gt;&lt;/SYSLOG&gt;</description>
      <pubDate>Thu, 18 Dec 2003 03:51:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147208#M900135</guid>
      <dc:creator>Mark Grant</dc:creator>
      <dc:date>2003-12-18T03:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Tail alternative</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147209#M900136</link>
      <description>Thanks guys!&lt;BR /&gt;&lt;BR /&gt;It works better now.&lt;BR /&gt;</description>
      <pubDate>Fri, 19 Dec 2003 16:49:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/tail-alternative/m-p/3147209#M900136</guid>
      <dc:creator>dude70_1</dc:creator>
      <dc:date>2003-12-19T16:49:11Z</dc:date>
    </item>
  </channel>
</rss>

