<?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: greping some patterns between some timeframes in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390818#M350192</link>
    <description>Shiv,&lt;BR /&gt;&lt;BR /&gt;Does every line have a date stamp, or is it more like and Oracle Alert log which looks like:&lt;BR /&gt;:&lt;BR /&gt;Date &amp;amp; time.&lt;BR /&gt;text&lt;BR /&gt;Date &amp;amp; other time.&lt;BR /&gt;other text&lt;BR /&gt;:&lt;BR /&gt;&lt;BR /&gt;If there is a timestamp everywhere, then Mark's suggestion will work fine for narrow time ranges. It gets a little coarse when looking for say 02:29 - 02:31.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And forgot about my remark:&lt;BR /&gt;&amp;gt;&amp;gt; A more complex rang might be tempting like:&lt;BR /&gt;'$2&amp;gt;"02:34:00." , $2&amp;gt;"02:37:00."'&lt;BR /&gt;&lt;BR /&gt;That's nonsense. The first clause keep on becoming true, so it is not a suiteable for  range. Brain-fart. I meant a range like:&lt;BR /&gt;&lt;BR /&gt;$ awk '$2&amp;gt;"02:30:99." &amp;amp;&amp;amp; $2&amp;lt;"02:39:99." &amp;amp;&amp;amp; /error/' tmp.txt&lt;BR /&gt;&lt;BR /&gt;But again... only if each line has a time &amp;amp; day which I assumed it did not.&lt;BR /&gt;&lt;BR /&gt;(yeah I know, there are not 99 seconds in a minute. That's just to amplify that awk treats $2 as a piece of strings, not a time )&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 31 Mar 2009 02:09:59 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2009-03-31T02:09:59Z</dc:date>
    <item>
      <title>greping some patterns between some timeframes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390814#M350188</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;I want to grep some error messages but the error message name is not known to me from some logs.&lt;BR /&gt;Log has the timing pattern as&lt;BR /&gt;2009-03-29 02:31:01.&lt;BR /&gt;&lt;BR /&gt;Say i want to grep messages for particular day 2009-03-29. The messages should be between time frame 02:31:01-02:39:59. Between this said timeframe i want grep say "errors or exception" like patterns.&lt;BR /&gt;&lt;BR /&gt;Can someone suggest some best way to do it. &lt;BR /&gt;I know some crude way but just curious to know if i can get some good tricks from seasoned Admins of this forums.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Shiv</description>
      <pubDate>Mon, 30 Mar 2009 23:10:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390814#M350188</guid>
      <dc:creator>Shivkumar</dc:creator>
      <dc:date>2009-03-30T23:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: greping some patterns between some timeframes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390815#M350189</link>
      <description>Grep isn't gonna cut that.&lt;BR /&gt;&lt;BR /&gt;A simple AWK range expression seems ok like:&lt;BR /&gt;$ awk '/03-29 02:33/ , /02:36:01./ {if ( /error/){print}}' tmp.txt&lt;BR /&gt;But it only works if you can garantue each minute to be in the file.&lt;BR /&gt;&lt;BR /&gt;A more complex rang might be tempting like:&lt;BR /&gt;'$2&amp;gt;"02:34:00." , $2&amp;gt;"02:37:00."'&lt;BR /&gt;That will get close, but the none-date lines like 'error' muck that up.&lt;BR /&gt;&lt;BR /&gt;So you have to create your own 'zone' looking  for a time range. For example:&lt;BR /&gt;&lt;BR /&gt;$ awk '/2009/ &amp;amp;&amp;amp; $2&amp;gt;"02:32:00."{zone=1} /2009/ &amp;amp;&amp;amp; $2&amp;gt;"02:40:00."{zone=0} zone &amp;amp;&amp;amp; /error/' &lt;YOUR-FILE&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps, &lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/YOUR-FILE&gt;</description>
      <pubDate>Tue, 31 Mar 2009 01:39:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390815#M350189</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2009-03-31T01:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: greping some patterns between some timeframes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390816#M350190</link>
      <description>grep "2009-03-29 02:3"&lt;BR /&gt;&lt;BR /&gt;is very nearly what you are after.&lt;BR /&gt;&lt;BR /&gt;you can use regular expressions in grep too, so include [1-5] after the 02:3 to only get times from 02:31 to 02:35.&lt;BR /&gt;&lt;BR /&gt;I'm pretty sure all of these will work:&lt;BR /&gt;^ (Caret) = match expression at the start of a line, as in ^A.&lt;BR /&gt;$ (Question) = match expression at the end of a line, as in A$.&lt;BR /&gt;\ (Back Slash) = turn off the special meaning of the next character, as in \^.&lt;BR /&gt;[ ] (Brackets) = match any one of the enclosed characters, as in [aeiou]. Use Hyphen "-" for a range, as in [0-9].&lt;BR /&gt;[^ ] = match any one character except those enclosed in [ ], as in [^0-9].&lt;BR /&gt;. (Period) = match a single character of any value, except end of line.&lt;BR /&gt;* (Asterisk) = match zero or more of the preceding character or expression.&lt;BR /&gt;\{x,y\} = match x to y occurrences of the preceding.&lt;BR /&gt;\{x\} = match exactly x occurrences of the preceding.&lt;BR /&gt;\{x,\} = match x or more occurrences of the preceding.</description>
      <pubDate>Tue, 31 Mar 2009 01:42:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390816#M350190</guid>
      <dc:creator>Mark McDonald_2</dc:creator>
      <dc:date>2009-03-31T01:42:01Z</dc:date>
    </item>
    <item>
      <title>Re: greping some patterns between some timeframes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390817#M350191</link>
      <description>Once you can return the right date/time range, searching for errors and exceptions is easy. grep has a -e option that can be used many times and is more versatile than egrep and extended regex strings. Here's a way to search thru syslog for problems:&lt;BR /&gt; &lt;BR /&gt;grep -ie err -e fail -e exception -e nospace -e disable -e lockout -e exceed -e invalid -e attempt -e refuse /var/adm/syslog/syslog.log</description>
      <pubDate>Tue, 31 Mar 2009 01:55:55 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390817#M350191</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2009-03-31T01:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: greping some patterns between some timeframes</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390818#M350192</link>
      <description>Shiv,&lt;BR /&gt;&lt;BR /&gt;Does every line have a date stamp, or is it more like and Oracle Alert log which looks like:&lt;BR /&gt;:&lt;BR /&gt;Date &amp;amp; time.&lt;BR /&gt;text&lt;BR /&gt;Date &amp;amp; other time.&lt;BR /&gt;other text&lt;BR /&gt;:&lt;BR /&gt;&lt;BR /&gt;If there is a timestamp everywhere, then Mark's suggestion will work fine for narrow time ranges. It gets a little coarse when looking for say 02:29 - 02:31.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;And forgot about my remark:&lt;BR /&gt;&amp;gt;&amp;gt; A more complex rang might be tempting like:&lt;BR /&gt;'$2&amp;gt;"02:34:00." , $2&amp;gt;"02:37:00."'&lt;BR /&gt;&lt;BR /&gt;That's nonsense. The first clause keep on becoming true, so it is not a suiteable for  range. Brain-fart. I meant a range like:&lt;BR /&gt;&lt;BR /&gt;$ awk '$2&amp;gt;"02:30:99." &amp;amp;&amp;amp; $2&amp;lt;"02:39:99." &amp;amp;&amp;amp; /error/' tmp.txt&lt;BR /&gt;&lt;BR /&gt;But again... only if each line has a time &amp;amp; day which I assumed it did not.&lt;BR /&gt;&lt;BR /&gt;(yeah I know, there are not 99 seconds in a minute. That's just to amplify that awk treats $2 as a piece of strings, not a time )&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 31 Mar 2009 02:09:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/greping-some-patterns-between-some-timeframes/m-p/4390818#M350192</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2009-03-31T02:09:59Z</dc:date>
    </item>
  </channel>
</rss>

