<?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: scripting help. in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982345#M99813</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You can use this to extract the line corresponding to the current day (name) in the stanza beginning with "BACKUP":&lt;BR /&gt;&lt;BR /&gt;# perl -ne 'BEGIN{$d=substr(localtime,0,3)};$i++ if m/BACKUP/;print if $i &amp;amp;&amp;amp; m/$d/i' filename&lt;BR /&gt;&lt;BR /&gt;...If your file contained a line for today (a Thursday) in the "BACKUP" stanza, it would print that line.  You can capture that output in a shell variable and parse the fields you want however you want.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
    <pubDate>Thu, 01 Jun 2006 10:58:56 GMT</pubDate>
    <dc:creator>James R. Ferguson</dc:creator>
    <dc:date>2006-06-01T10:58:56Z</dc:date>
    <item>
      <title>scripting help.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982342#M99810</link>
      <description>Hi everyone,&lt;BR /&gt;&lt;BR /&gt;I am trying to create a script that checks the run time of a job from a file then works out whether another script should run.  ie&lt;BR /&gt;&lt;BR /&gt;script where date and times are:&lt;BR /&gt;&lt;BR /&gt;LOG&lt;BR /&gt;&lt;BR /&gt;monday    2200 - 0700&lt;BR /&gt;tuesday   0800 - 1700&lt;BR /&gt;wednesday 0800 - 1700&lt;BR /&gt;etc etc&lt;BR /&gt;&lt;BR /&gt;BACKUP&lt;BR /&gt;&lt;BR /&gt;monday    0800 - 0700&lt;BR /&gt;tuesday   0900 - 1700&lt;BR /&gt;wednesday 0800 - 1700&lt;BR /&gt;etc etc&lt;BR /&gt;&lt;BR /&gt;so &lt;BR /&gt;&lt;BR /&gt;i try running awk to search for BACKUP then check the date and get the time as a string to be tested against the current time.&lt;BR /&gt;&lt;BR /&gt;but &lt;BR /&gt;&lt;BR /&gt;i just cannot work it out,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;please help.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Jun 2006 10:17:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982342#M99810</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2006-06-01T10:17:40Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982343#M99811</link>
      <description>You can do the following&lt;BR /&gt;&lt;BR /&gt;todaysday=$(date +%A | tr -s [:upper:] [:lower:])&lt;BR /&gt;todaystime=$(date +%H%M)&lt;BR /&gt;awk '/BACKUP/,/ZZZ/' logfile | grep $todaysdate | head -1 | read logday starttime junk1 endtime&lt;BR /&gt;if [[ $todaystime -ge $starttime ]]&lt;BR /&gt; then&lt;BR /&gt;    if [[ $todaystime -le $endtime ]]&lt;BR /&gt;     then&lt;BR /&gt;        echo Run script&lt;BR /&gt;    fi&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this is what your requirement is.&lt;BR /&gt;Please clarify if not.&lt;BR /&gt;&lt;BR /&gt;Best luck.&lt;BR /&gt;Ninad</description>
      <pubDate>Thu, 01 Jun 2006 10:36:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982343#M99811</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-06-01T10:36:40Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982344#M99812</link>
      <description>Sorry - forgot to check the day. heres the modofied one&lt;BR /&gt;&lt;BR /&gt;todaysday=$(date +%A | tr -s [:upper:] [:lower:])&lt;BR /&gt;todaystime=$(date +%H%M)&lt;BR /&gt;awk '/BACKUP/,/ZZZ/' logfile | grep $todaysdate | head -1 | read logday starttime junk1 endtime&lt;BR /&gt;if [[ "$todaysday" = "$logday" ]]&lt;BR /&gt;then&lt;BR /&gt;if [[ $todaystime -ge $starttime ]]&lt;BR /&gt;then&lt;BR /&gt;if [[ $todaystime -le $endtime ]]&lt;BR /&gt;then&lt;BR /&gt;echo Run script&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;fi&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ninad</description>
      <pubDate>Thu, 01 Jun 2006 10:38:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982344#M99812</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-06-01T10:38:16Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982345#M99813</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;You can use this to extract the line corresponding to the current day (name) in the stanza beginning with "BACKUP":&lt;BR /&gt;&lt;BR /&gt;# perl -ne 'BEGIN{$d=substr(localtime,0,3)};$i++ if m/BACKUP/;print if $i &amp;amp;&amp;amp; m/$d/i' filename&lt;BR /&gt;&lt;BR /&gt;...If your file contained a line for today (a Thursday) in the "BACKUP" stanza, it would print that line.  You can capture that output in a shell variable and parse the fields you want however you want.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Thu, 01 Jun 2006 10:58:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982345#M99813</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2006-06-01T10:58:56Z</dc:date>
    </item>
    <item>
      <title>Re: scripting help.</title>
      <link>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982346#M99814</link>
      <description>thank you both for your suggestions, even though they both work I am using Ninad method as I am not familiar with perl.&lt;BR /&gt;&lt;BR /&gt;cheers!&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Lawrenz0</description>
      <pubDate>Fri, 02 Jun 2006 03:10:45 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/scripting-help/m-p/4982346#M99814</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2006-06-02T03:10:45Z</dc:date>
    </item>
  </channel>
</rss>

