<?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: Script to add time in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974878#M102136</link>
    <description>What about doing iostat for a short time period - multiple times?&lt;BR /&gt;&lt;BR /&gt;IOSTAT=`iostat 5 5`&lt;BR /&gt;echo "`date` $IOSTAT" &amp;gt;&amp;gt;  iostat.out&lt;BR /&gt;&lt;BR /&gt;or something like that...&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
    <pubDate>Fri, 21 Apr 2006 08:48:57 GMT</pubDate>
    <dc:creator>Geoff Wild</dc:creator>
    <dc:date>2006-04-21T08:48:57Z</dc:date>
    <item>
      <title>Script to add time</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974877#M102135</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Has anyone developed a script or can give me a clue on how to go about for the following.&lt;BR /&gt;I have collected iostat output running with interval of 600 secs and for a count of 144 - thus it runs for 24 hrs, the output is redirected to a file. Now If I want to insert the time in the stats file , knowing the start time and the interval - how can I do this ? e.g. I start to collect iostat as&lt;BR /&gt;iostat 600 144 &amp;gt; iostat.out&lt;BR /&gt;at say 10:00 on 210406 then I want to insert the date:time for each entry in the iostat output. The output for a particular interval is seperated by blank lines (you can see running the command for small interval and count to see the output file)&lt;BR /&gt;so if output is like&lt;BR /&gt;&lt;BR /&gt;c100t6d0    113    12.9     1.0  &lt;BR /&gt;c100t5d0     21     4.1     1.0 &lt;BR /&gt;&lt;BR /&gt;c100t6d0    120    17.6     1.0  &lt;BR /&gt;c100t5d0     43     5.5     1.0 &lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;and so on. and I want to have output like&lt;BR /&gt;&lt;BR /&gt;210406#10:00  c100t6d0    113    12.9     1.0&lt;BR /&gt;210406#10:00  c100t5d0     21     4.1     1.0&lt;BR /&gt;&lt;BR /&gt;210406#10:10  c100t6d0    120    17.6     1.0 &lt;BR /&gt;210406#10:10  c100t5d0     43     5.5     1.0&lt;BR /&gt;.&lt;BR /&gt;.&lt;BR /&gt;and so on. Also the date change should be taken into account as the stats are for 24 hrs or more.&lt;BR /&gt;Thanks a lot,&lt;BR /&gt;Ninad&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Apr 2006 08:37:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974877#M102135</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-04-21T08:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Script to add time</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974878#M102136</link>
      <description>What about doing iostat for a short time period - multiple times?&lt;BR /&gt;&lt;BR /&gt;IOSTAT=`iostat 5 5`&lt;BR /&gt;echo "`date` $IOSTAT" &amp;gt;&amp;gt;  iostat.out&lt;BR /&gt;&lt;BR /&gt;or something like that...&lt;BR /&gt;&lt;BR /&gt;Rgds...Geoff</description>
      <pubDate>Fri, 21 Apr 2006 08:48:57 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974878#M102136</guid>
      <dc:creator>Geoff Wild</dc:creator>
      <dc:date>2006-04-21T08:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Script to add time</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974879#M102137</link>
      <description>Geoff,&lt;BR /&gt;&lt;BR /&gt;The problem with your suggestion is that each time the iostat runs it first shows the stats till that point in time - or something like that as the first output and then it shows the actual stats collected for the mentioned interval - this is one problem. The second problem is that if I get the iostat output in IOSTAT variable then there are no new line characters seperating the outputs for each disk.&lt;BR /&gt;Can you suggest some alternative.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ninad</description>
      <pubDate>Fri, 21 Apr 2006 09:01:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974879#M102137</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-04-21T09:01:51Z</dc:date>
    </item>
    <item>
      <title>Re: Script to add time</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974880#M102138</link>
      <description>Something as simple as the following  gets you almost all the way there except the lines for multiple disk do not have the time. Maybe this will give you some better idea.&lt;BR /&gt;&lt;BR /&gt;sar -d 1 1|awk 'NR &amp;gt; 4 {print "'"`date +%d%m%y`"'#"$0}'&lt;BR /&gt;&lt;BR /&gt;output looks like this&lt;BR /&gt;&lt;BR /&gt;210406#09:00:18   c8t0d0    6.00    0.50       4      24    1.86   19.72&lt;BR /&gt;210406#          c19t0d0    2.00    0.50       2      16    0.73   16.09&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 21 Apr 2006 09:03:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974880#M102138</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2006-04-21T09:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: Script to add time</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974881#M102139</link>
      <description>Tim,&lt;BR /&gt;&lt;BR /&gt;Thats a nice one, but I want to use iostat as it gives the disk stats for all disks, where as sar gives stats for the most used disks - Please correct me if I am wrong.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ninad</description>
      <pubDate>Fri, 21 Apr 2006 09:15:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974881#M102139</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-04-21T09:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Script to add time</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974882#M102140</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;iostat 6 1|while read line&lt;BR /&gt;do&lt;BR /&gt;echo $(date|cut -f1-4 -d" ")" : ""$line"&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;If you like the format play with it&lt;BR /&gt;&lt;BR /&gt;by putting 600 144&lt;BR /&gt;&lt;BR /&gt;            Steve Steel</description>
      <pubDate>Fri, 21 Apr 2006 09:15:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974882#M102140</guid>
      <dc:creator>Steve Steel</dc:creator>
      <dc:date>2006-04-21T09:15:53Z</dc:date>
    </item>
    <item>
      <title>Re: Script to add time</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974883#M102141</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;with GNU-awk it's a oneliner, a nearly identical perl solution should be easy.&lt;BR /&gt;- I skip empty lines.&lt;BR /&gt;- Note, that depending an your header lines of iostat, you have to change for padding.&lt;BR /&gt;- Your date format consists of 10chars - thats &lt;BR /&gt;the number of blanks in the first print statement.&lt;BR /&gt;&lt;BR /&gt;iostat ... | gawk -v head=2 'NR&amp;lt;=head {print "         ",$0}; NR&amp;gt;head &amp;amp;&amp;amp; NF {print strftime("%d%m%y#%H:%M"),$0}'&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 21 Apr 2006 09:19:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974883#M102141</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2006-04-21T09:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Script to add time</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974884#M102142</link>
      <description>iostat makes it easier.&lt;BR /&gt;&lt;BR /&gt;iostat|awk 'NR &amp;gt; 3 {print "'"`date +%d%m%y#%T `"'"$0}'     &lt;BR /&gt;&lt;BR /&gt;210406#09:40:15  c8t0d0      0     0.0     1.0  &lt;BR /&gt;210406#09:40:15 c19t0d0      0     0.0     1.0  &lt;BR /&gt;210406#09:40:15 c19t3d0      0     0.0     1.0  &lt;BR /&gt;210406#09:40:15  c8t3d0      0     0.0     1.0  &lt;BR /&gt;210406#09:40:15  c8t1d0      0     0.0     1.0  &lt;BR /&gt;210406#09:40:15  c8t2d0      0     0.0     1.0  &lt;BR /&gt;210406#09:40:15 c19t1d0      0     0.0     1.0  &lt;BR /&gt;210406#09:40:15 c19t2d0      0     0.0     1.0  &lt;BR /&gt;</description>
      <pubDate>Fri, 21 Apr 2006 09:41:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974884#M102142</guid>
      <dc:creator>Tim Nelson</dc:creator>
      <dc:date>2006-04-21T09:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Script to add time</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974885#M102143</link>
      <description>Steve,Tim,&lt;BR /&gt;&lt;BR /&gt;Thats exactly what I wanted.&lt;BR /&gt;Thanks a lot for the wonderful help.&lt;BR /&gt;&lt;BR /&gt;Peter,&lt;BR /&gt;Unfortunately I dont have gawk currently. But will use your suggestion some time latter.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Ninad</description>
      <pubDate>Fri, 21 Apr 2006 09:49:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-add-time/m-p/4974885#M102143</guid>
      <dc:creator>Ninad_1</dc:creator>
      <dc:date>2006-04-21T09:49:30Z</dc:date>
    </item>
  </channel>
</rss>

