<?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: orders in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241655#M173763</link>
    <description>Hmm, your description is not very specific.&lt;BR /&gt;Like is that text file already sorted by time? What about am-pm, did you want to grep for a orders in a 5 minute block where that block in perhpas indicated in a variable?&lt;BR /&gt;&lt;BR /&gt;Here is a perl (or awk) solution to group an assumed to be pre-sorted file in labeled 5-minute intervals.&lt;BR /&gt;&lt;BR /&gt;usage: perl -n time-groups.pl &amp;lt; textfile&lt;BR /&gt;Where time-groups.pl contains:&lt;BR /&gt;&lt;BR /&gt;if (/(12|01|02|03)(:\d+:)(\d+)/) {&lt;BR /&gt;  $range = sprintf("%s%s%02d",$1,$2,5*int($3/5));&lt;BR /&gt;  print "\n-- $range --\n" unless ($headers{$range}++);&lt;BR /&gt;  print;&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;find line with 12,01,02 or 03 (remeber in $1) followed be a decimal between colons (remember in $2) followed by a decimal (in $3).&lt;BR /&gt;Calculate group header as the first 2 found strings for HR:MM: and 'floor' the seconds by fives. ( divide by factor, int, re-mutiply by factor).&lt;BR /&gt;Print header with group range unless already printed as indicated by a counter in hash array.&lt;BR /&gt;Print line (if is matched the range)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Sample input:&lt;BR /&gt;&lt;BR /&gt;12:00:04 aap&lt;BR /&gt;02:09:40 een noot&lt;BR /&gt;02:09:41 twee noot&lt;BR /&gt;02:09:42 drie noot&lt;BR /&gt;03:59:59 mies&lt;BR /&gt;04:01:00 geen teun&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Sample output:&lt;BR /&gt;&lt;BR /&gt;-- 12:00:00 --&lt;BR /&gt;12:00:04 aap&lt;BR /&gt;&lt;BR /&gt;-- 02:09:40 --&lt;BR /&gt;02:09:40 een noot&lt;BR /&gt;02:09:41 twee noot&lt;BR /&gt;02:09:42 drie noot&lt;BR /&gt;&lt;BR /&gt;-- 03:59:55 --&lt;BR /&gt;03:59:59 mies&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So now, what did you really want to see? &lt;BR /&gt;:-).&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 06 Apr 2004 22:11:14 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2004-04-06T22:11:14Z</dc:date>
    <item>
      <title>orders</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241651#M173759</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have plain text file which has business orders with time stamp. I want to grep orders for every five minutes starting from 12PM-4PM. Time format is like HH:MM:SS.Please help.&lt;BR /&gt;&lt;BR /&gt;Thanks.</description>
      <pubDate>Tue, 06 Apr 2004 15:28:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241651#M173759</guid>
      <dc:creator>SAM_24</dc:creator>
      <dc:date>2004-04-06T15:28:25Z</dc:date>
    </item>
    <item>
      <title>Re: orders</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241652#M173760</link>
      <description>this will give you the lines with a time between, 0-4, 5-9, 10-14, increments.&lt;BR /&gt;&lt;BR /&gt;awk -v hour=$hour -v min-$min '&lt;BR /&gt;/[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}/ {&lt;BR /&gt;&lt;BR /&gt;for ( i=1,i&amp;lt;=NF;i++ ) {&lt;BR /&gt;if ( $i ~ /[0-9]{1,2}:[0-9]{1,2}:[0-9]{1,2}/ ) date = $i;&lt;BR /&gt;}&lt;BR /&gt;split(date,a,":");&lt;BR /&gt;if ( hour == a[1] ) {&lt;BR /&gt;m1=sprintf("%d",a[2]/5;&lt;BR /&gt;m2=sprintf("%d",a[2]/5;&lt;BR /&gt;if ( m1 == m2 ) print $0;&lt;BR /&gt;}}'&lt;BR /&gt;&lt;BR /&gt;then it is pretty easy to loop through hours and minutes &lt;BR /&gt;ehour=5&lt;BR /&gt;hour=12&lt;BR /&gt;min=0&lt;BR /&gt;while (( $hour &amp;lt; ehour ))&lt;BR /&gt;do&lt;BR /&gt;while (( $min &amp;lt; 60 ))&lt;BR /&gt;do&lt;BR /&gt;&lt;BR /&gt;#do the above script&lt;BR /&gt;&lt;BR /&gt;min=$(( $min + 5 ))&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;hour=$(( $hour + 1 ))&lt;BR /&gt;if (( $hour &amp;gt; 12 )) ;then&lt;BR /&gt;hour=$(( $hour - 12 ))&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;you'll have to decide how you handle AM/PM issues</description>
      <pubDate>Tue, 06 Apr 2004 16:55:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241652#M173760</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-04-06T16:55:36Z</dc:date>
    </item>
    <item>
      <title>Re: orders</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241653#M173761</link>
      <description>oops these both should be a[2]:&lt;BR /&gt;&lt;BR /&gt;m1=sprintf("%d",a[2]/5;&lt;BR /&gt;m2=sprintf("%d",a[2]/5;&lt;BR /&gt;&lt;BR /&gt;one should be min, as in:&lt;BR /&gt;&lt;BR /&gt;m1=sprintf("%d",a[2]/5;&lt;BR /&gt;m2=sprintf("%d",min/5;&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Apr 2004 17:08:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241653#M173761</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2004-04-06T17:08:58Z</dc:date>
    </item>
    <item>
      <title>Re: orders</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241654#M173762</link>
      <description>Hello,&lt;BR /&gt;&lt;BR /&gt;Not really sure what you want...&lt;BR /&gt;if you want to get all lines from a text file where the hours are 12,01,02,03,04 PM with regular minutes 00 to 59 ... :&lt;BR /&gt;&lt;BR /&gt;grep '[12,01,02,03,04]:[0-5][0-9]:[0-5][0-9]' textfile&lt;BR /&gt;&lt;BR /&gt;For the 5 minutes interval, the regular expression can be :&lt;BR /&gt;[05,10,15,20,25,30,35,40,45,50,55]&lt;BR /&gt;&lt;BR /&gt;Hope that helps</description>
      <pubDate>Tue, 06 Apr 2004 17:22:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241654#M173762</guid>
      <dc:creator>Nicolas Dumeige</dc:creator>
      <dc:date>2004-04-06T17:22:50Z</dc:date>
    </item>
    <item>
      <title>Re: orders</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241655#M173763</link>
      <description>Hmm, your description is not very specific.&lt;BR /&gt;Like is that text file already sorted by time? What about am-pm, did you want to grep for a orders in a 5 minute block where that block in perhpas indicated in a variable?&lt;BR /&gt;&lt;BR /&gt;Here is a perl (or awk) solution to group an assumed to be pre-sorted file in labeled 5-minute intervals.&lt;BR /&gt;&lt;BR /&gt;usage: perl -n time-groups.pl &amp;lt; textfile&lt;BR /&gt;Where time-groups.pl contains:&lt;BR /&gt;&lt;BR /&gt;if (/(12|01|02|03)(:\d+:)(\d+)/) {&lt;BR /&gt;  $range = sprintf("%s%s%02d",$1,$2,5*int($3/5));&lt;BR /&gt;  print "\n-- $range --\n" unless ($headers{$range}++);&lt;BR /&gt;  print;&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;find line with 12,01,02 or 03 (remeber in $1) followed be a decimal between colons (remember in $2) followed by a decimal (in $3).&lt;BR /&gt;Calculate group header as the first 2 found strings for HR:MM: and 'floor' the seconds by fives. ( divide by factor, int, re-mutiply by factor).&lt;BR /&gt;Print header with group range unless already printed as indicated by a counter in hash array.&lt;BR /&gt;Print line (if is matched the range)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Sample input:&lt;BR /&gt;&lt;BR /&gt;12:00:04 aap&lt;BR /&gt;02:09:40 een noot&lt;BR /&gt;02:09:41 twee noot&lt;BR /&gt;02:09:42 drie noot&lt;BR /&gt;03:59:59 mies&lt;BR /&gt;04:01:00 geen teun&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Sample output:&lt;BR /&gt;&lt;BR /&gt;-- 12:00:00 --&lt;BR /&gt;12:00:04 aap&lt;BR /&gt;&lt;BR /&gt;-- 02:09:40 --&lt;BR /&gt;02:09:40 een noot&lt;BR /&gt;02:09:41 twee noot&lt;BR /&gt;02:09:42 drie noot&lt;BR /&gt;&lt;BR /&gt;-- 03:59:55 --&lt;BR /&gt;03:59:59 mies&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;So now, what did you really want to see? &lt;BR /&gt;:-).&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 06 Apr 2004 22:11:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241655#M173763</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-04-06T22:11:14Z</dc:date>
    </item>
    <item>
      <title>Re: orders</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241656#M173764</link>
      <description>Here is an other cut at a possible solution:&lt;BR /&gt;&lt;BR /&gt;usage: perl time-range-grep.pl hh:mm:ss [minutes] &amp;lt; textfile&lt;BR /&gt;&lt;BR /&gt;Where time-range-grep.pl contains:&lt;BR /&gt;&lt;BR /&gt;($h,$m,$s)=split(/:/,shift);&lt;BR /&gt;$window=shift;&lt;BR /&gt;$window=5 unless ($window);&lt;BR /&gt;$h=0 if ($h==12);&lt;BR /&gt;$start=$h*60+$m;&lt;BR /&gt;while (&amp;lt;&amp;gt;) {&lt;BR /&gt;  if (/(\d+):(\d+):\d+/) {&lt;BR /&gt;    $t = ($1==12)? $2 : 60*$1 + $2;&lt;BR /&gt;    print  if (($t &amp;gt;= $start) &amp;amp;&amp;amp; ($t &amp;lt; $start+$window)) ;&lt;BR /&gt;    }&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;parse first argument into hours,minute&lt;BR /&gt;parse optional second argument into window, default 5&lt;BR /&gt;calculate start minute for period&lt;BR /&gt;find line with timestamps&lt;BR /&gt;calculate to minutes, making an exception of hour=12&lt;BR /&gt;in range? then print.&lt;BR /&gt;&lt;BR /&gt;Sample input:&lt;BR /&gt;&lt;BR /&gt;12:00:04 aap&lt;BR /&gt;02:09:40 een noot&lt;BR /&gt;02:09:41 twee noot&lt;BR /&gt;02:09:42 drie noot&lt;BR /&gt;03:59:59 mies&lt;BR /&gt;04:01:00 geen teun&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Sample output:&lt;BR /&gt;&lt;BR /&gt;# perl x.p 02:09:40 &amp;lt; x&lt;BR /&gt;02:09:40 een noot&lt;BR /&gt;02:09:41 twee noot&lt;BR /&gt;02:09:42 drie noot&lt;BR /&gt;# perl x.p 02:03:40 &amp;lt; x&lt;BR /&gt;# perl x.p 02:03:40 10 &amp;lt; x&lt;BR /&gt;02:09:40 een noot&lt;BR /&gt;02:09:41 twee noot&lt;BR /&gt;02:09:42 drie noot&lt;BR /&gt;</description>
      <pubDate>Wed, 07 Apr 2004 00:01:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/orders/m-p/3241656#M173764</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2004-04-07T00:01:28Z</dc:date>
    </item>
  </channel>
</rss>

