<?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: need help on ksh scripting in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090398#M144680</link>
    <description>you could use A. Clay Stephenson's caljd.sh script. just do a search on caljd.sh.  just be sure to get the latest version intead of an earlier version that was posted quite a while ago.  I think he has a site where you can download the latest version.&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;you could use perl and as suggested in the previous post, use the localtime and timelocal functions to convert your dates to seconds from the epoch, do your arthimetic, and format to your desired output</description>
    <pubDate>Sat, 11 Oct 2003 02:29:40 GMT</pubDate>
    <dc:creator>curt larson_1</dc:creator>
    <dc:date>2003-10-11T02:29:40Z</dc:date>
    <item>
      <title>need help on ksh scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090393#M144675</link>
      <description>&lt;BR /&gt;Does anyone have any good suggestion on calculating the duration for the data below using ksh scripts? I am think of using year, month, day, hour and minute for comparison to find the duration. Does anyone have any good suggestion such as using awk, sed, sort, etc..&lt;BR /&gt;&lt;BR /&gt;08/22/02|00:00|   300| 100| &amp;lt;---- 1st duration&lt;BR /&gt;&lt;BR /&gt;09/22/02|00:05|   299| 100| &amp;lt;---- 2nd duration&lt;BR /&gt;09/22/02|00:10|   299| 100|&lt;BR /&gt;&lt;BR /&gt;11/12/02|00:15|   300| 100| &amp;lt;---- 3rd duration&lt;BR /&gt;&lt;BR /&gt;12/30/02|23:50|   299| 100| &amp;lt;---- 4th duration&lt;BR /&gt;&lt;BR /&gt;12/31/02|23:50|   299| 100| &amp;lt;---- 5th duration&lt;BR /&gt;12/31/02|23:55|   299| 100|&lt;BR /&gt;01/01/03|00:00|   299| 100|&lt;BR /&gt;01/01/03|00:05|   299| 100|&lt;BR /&gt;&lt;BR /&gt;01/01/03|00:35|   299| 100| &amp;lt;---- 6th duration&lt;BR /&gt;&lt;BR /&gt;02/19/03|00:40|   300| 100| &amp;lt;---- 7th duration&lt;BR /&gt;&lt;BR /&gt;03/03/03|00:45|   299| 100| &amp;lt;---- 8th duration&lt;BR /&gt;03/03/03|00:50|   299| 100|&lt;BR /&gt;&lt;BR /&gt;03/11/03|00:55|   299| 100| &amp;lt;---- 9th duration&lt;BR /&gt;</description>
      <pubDate>Fri, 10 Oct 2003 05:11:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090393#M144675</guid>
      <dc:creator>YLTan</dc:creator>
      <dc:date>2003-10-10T05:11:59Z</dc:date>
    </item>
    <item>
      <title>Re: need help on ksh scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090394#M144676</link>
      <description>Can't figure out what is in cols 3 &amp;amp; 4?&lt;BR /&gt;Please explain the data format.&lt;BR /&gt;After that it should be easy with awk -F"|"&lt;BR /&gt;-- Graham</description>
      <pubDate>Fri, 10 Oct 2003 05:21:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090394#M144676</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-10T05:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: need help on ksh scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090395#M144677</link>
      <description>&lt;BR /&gt;1st col is date in mm/dd/yy&lt;BR /&gt;2nd col is 24hrs time in hh:mm &lt;BR /&gt;3rd col is data&lt;BR /&gt;4th col is also max CPU%&lt;BR /&gt;&lt;BR /&gt;i need to output the report of the duration of the max data e.g.&lt;BR /&gt;&lt;BR /&gt;Start 12/31/02 23:50 and End 01/01/03 00:05 - 15minutes when CPU% is at max&lt;BR /&gt;&lt;BR /&gt;Start 01/01/03 00:05 - 5 minutes when CPU% is max</description>
      <pubDate>Fri, 10 Oct 2003 05:36:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090395#M144677</guid>
      <dc:creator>YLTan</dc:creator>
      <dc:date>2003-10-10T05:36:01Z</dc:date>
    </item>
    <item>
      <title>Re: need help on ksh scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090396#M144678</link>
      <description>Ok, I think I understand.&lt;BR /&gt;Every time col 3 changes you want a report of the time since it last changed.&lt;BR /&gt;This is not trivial with awk and I'm no Perl wizard.&lt;BR /&gt;I suggest you wait a couple of hours until the US comes online, and Clay will solve your problem with his caljd script.&lt;BR /&gt;-- Graham</description>
      <pubDate>Fri, 10 Oct 2003 05:55:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090396#M144678</guid>
      <dc:creator>Graham Cameron_1</dc:creator>
      <dc:date>2003-10-10T05:55:40Z</dc:date>
    </item>
    <item>
      <title>Re: need help on ksh scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090397#M144679</link>
      <description>First think I would do is get my hands on Gnu Date.  It has the ability to convert a date to seconds since epoch.  For your hours and seconds those are easily converted to seconds.&lt;BR /&gt;&lt;BR /&gt;The syntax to do this w/ the Gnu date command is:&lt;BR /&gt;date -d "mm/dd/yy HH:MM:SS" +%s&lt;BR /&gt;&lt;BR /&gt;From your example:&lt;BR /&gt;&lt;BR /&gt;12/31/02|23:55| 299| 100|&lt;BR /&gt;01/01/03|00:00| 299| 100|&lt;BR /&gt;01/01/03|00:05| 299| 100|&lt;BR /&gt;01/01/03|00:35| 299| 100| &amp;lt;---- 6th duration&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;   In your example 12/31/02 23:55 is equal to 1,041,400,500 seconds since epoch.  And 01/01/03 00:35 is 1,041,402,900 seconds since epoch.   Subtract the prior from the later and you get 2,400 seconds duration that it was at 299.  You can then just roll up the 2,400 to days, hours, minutes, seconds by dividing it out.&lt;BR /&gt;&lt;BR /&gt;1 day = 86,400 seconds&lt;BR /&gt;1 hour = 3,600 seconds&lt;BR /&gt;1 minute = 60 seconds (of course)&lt;BR /&gt;&lt;BR /&gt;So 2,400 seconds is 40 minutes.&lt;BR /&gt;&lt;BR /&gt;Gnu Date is part of sh_utils on the HP Porting and archive center.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://hpux.cs.utah.edu/hppd/hpux/Gnu/sh_utils-2.0/" target="_blank"&gt;http://hpux.cs.utah.edu/hppd/hpux/Gnu/sh_utils-2.0/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope that helps!&lt;BR /&gt;Eric</description>
      <pubDate>Fri, 10 Oct 2003 17:24:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090397#M144679</guid>
      <dc:creator>Eric Buckner</dc:creator>
      <dc:date>2003-10-10T17:24:35Z</dc:date>
    </item>
    <item>
      <title>Re: need help on ksh scripting</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090398#M144680</link>
      <description>you could use A. Clay Stephenson's caljd.sh script. just do a search on caljd.sh.  just be sure to get the latest version intead of an earlier version that was posted quite a while ago.  I think he has a site where you can download the latest version.&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;you could use perl and as suggested in the previous post, use the localtime and timelocal functions to convert your dates to seconds from the epoch, do your arthimetic, and format to your desired output</description>
      <pubDate>Sat, 11 Oct 2003 02:29:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/need-help-on-ksh-scripting/m-p/3090398#M144680</guid>
      <dc:creator>curt larson_1</dc:creator>
      <dc:date>2003-10-11T02:29:40Z</dc:date>
    </item>
  </channel>
</rss>

