<?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: data manipulation in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061438#M94301</link>
    <description>guys:&lt;BR /&gt;&lt;BR /&gt;1 start(S) end(E)&lt;BR /&gt;2 PID (1161480)&lt;BR /&gt;3 date (20070720)&lt;BR /&gt;4 time (1205) =&amp;gt; is that HHMM ?&lt;BR /&gt;5 program (createWebOrdFile.4ge)&lt;BR /&gt;6 user (cronlog)&lt;BR /&gt;7 is where the script is run from (.)&lt;BR /&gt;8 script&lt;BR /&gt;9,option ie &amp;lt;script&amp;gt; &lt;T1&gt; - T1 being store identifier.&lt;BR /&gt;&lt;BR /&gt;option 7 can be ignored &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/T1&gt;</description>
    <pubDate>Mon, 06 Aug 2007 05:54:12 GMT</pubDate>
    <dc:creator>lawrenzo_1</dc:creator>
    <dc:date>2007-08-06T05:54:12Z</dc:date>
    <item>
      <title>data manipulation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061432#M94295</link>
      <description>Hello all,&lt;BR /&gt;&lt;BR /&gt;Please could you provide some help / ideas:&lt;BR /&gt;&lt;BR /&gt;I have a file that is updated everytime a job is started and finishes against an informix database.  I would like to run some code against the file to determine the start and stop times, also I will develop the script to calculate the average run times.&lt;BR /&gt;&lt;BR /&gt;the logfile entries are as follows:&lt;BR /&gt;&lt;BR /&gt;start/end  PID  date   time   program  user   script  option&lt;BR /&gt;&lt;BR /&gt;S|1161480|20070720|1205|createWebOrdFile.4ge|cronlog|.|/usr/cs3/scripts/JDE/createWebOrdFile||&lt;BR /&gt;E|1161480|20070720|1205|createWebOrdFile.4ge|cronlog|.|/usr/cs3/scripts/JDE/createWebOrdFile||&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;what I would be looking for is the script o be run on the previous day for a 24hr period and detail every job that has run  including start and stop times including the option the script was run with:&lt;BR /&gt;&lt;BR /&gt;scriptname:4ge program name:start:stop:duration:option&lt;BR /&gt;&lt;BR /&gt;any help will be much appreciated.&lt;BR /&gt;&lt;BR /&gt;Thanks &lt;BR /&gt;&lt;BR /&gt;Chris.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 03 Aug 2007 10:51:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061432#M94295</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-08-03T10:51:09Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061433#M94296</link>
      <description>&lt;!--!*#--&gt;Try the awk script below:&lt;BR /&gt;&lt;BR /&gt;awk -F\| '{&lt;BR /&gt;    if ($1=="S") {s[$2]=$8":"$5":"$3" "$4;str=$4}&lt;BR /&gt;    else if ($1=="E") {e[$2]=$3" "$4;stp=$4}&lt;BR /&gt;}END{for(i in s) print s[i]":"e[i]":"str-stp}' file</description>
      <pubDate>Fri, 03 Aug 2007 11:38:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061433#M94296</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-08-03T11:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061434#M94297</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm sorting the description of all of the fields of the logfile you gave:&lt;BR /&gt;1  start(S) end(E)&lt;BR /&gt;2  PID (1161480)&lt;BR /&gt;3  date (20070720)&lt;BR /&gt;4  time (1205)  =&amp;gt; is that HHMM ?&lt;BR /&gt;5  program (createWebOrdFile.4ge)&lt;BR /&gt;6  user (cronlog)&lt;BR /&gt;7  script (.)&lt;BR /&gt;8  option (/usr/cs3/....)&lt;BR /&gt;9,10 ignored&lt;BR /&gt;&lt;BR /&gt;Please form your requested output format like this:&lt;BR /&gt;"script:"(7) "prog:"(5) ...&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Fri, 03 Aug 2007 11:50:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061434#M94297</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-08-03T11:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061435#M94298</link>
      <description>Actually Peter is spot-on. The sample input provided is sketchy as there isn't a one-to-one correspondence between the fields and its data. The data seems to be off by a few. Same goes for the output. Please provide a clearer example of the input and output.&lt;BR /&gt;&lt;BR /&gt;~thanks</description>
      <pubDate>Fri, 03 Aug 2007 12:12:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061435#M94298</guid>
      <dc:creator>Sandman!</dc:creator>
      <dc:date>2007-08-03T12:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061436#M94299</link>
      <description>Hi Chris:&lt;BR /&gt;&lt;BR /&gt;&amp;gt; ...previous day for a 24hr period...&lt;BR /&gt;&lt;BR /&gt;Would you define what you mean, please.  Will that definition include records that start on one day and end on another?&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Fri, 03 Aug 2007 12:25:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061436#M94299</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-03T12:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061437#M94300</link>
      <description>Yes this will include defenitions that run one day into another however I will output to a daily file and put a condition that is a pid is not found then check the current audit log.&lt;BR /&gt;&lt;BR /&gt;unless there are any other suggestions?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Mon, 06 Aug 2007 05:48:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061437#M94300</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-08-06T05:48:11Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061438#M94301</link>
      <description>guys:&lt;BR /&gt;&lt;BR /&gt;1 start(S) end(E)&lt;BR /&gt;2 PID (1161480)&lt;BR /&gt;3 date (20070720)&lt;BR /&gt;4 time (1205) =&amp;gt; is that HHMM ?&lt;BR /&gt;5 program (createWebOrdFile.4ge)&lt;BR /&gt;6 user (cronlog)&lt;BR /&gt;7 is where the script is run from (.)&lt;BR /&gt;8 script&lt;BR /&gt;9,option ie &amp;lt;script&amp;gt; &lt;T1&gt; - T1 being store identifier.&lt;BR /&gt;&lt;BR /&gt;option 7 can be ignored &lt;BR /&gt;&lt;BR /&gt;Thanks&lt;/T1&gt;</description>
      <pubDate>Mon, 06 Aug 2007 05:54:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061438#M94301</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-08-06T05:54:12Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061439#M94302</link>
      <description>&lt;!--!*#--&gt;Ok,&lt;BR /&gt;&lt;BR /&gt;my solution does not use any values of the End-entry except PID, date + time; checking of other fields is not provided. Incomplete lines (missing/additional fields) are ingored.&lt;BR /&gt;The PID will be used as a unique identifier - PIDs of different days will Be IGNORED (you told, that this is okay!). So runtime will be solely based on 'time'. If necessary, this could be handled more graceful.&lt;BR /&gt;The empty field 9 (of your example) is 'option'.&lt;BR /&gt;If you need any headers/prefixes, modify them at output in 'END'.&lt;BR /&gt;&lt;BR /&gt;So let's try this:&lt;BR /&gt;&lt;BR /&gt;awk -F'|' 'NF!=10 {next}&lt;BR /&gt;{idx=$2""}&lt;BR /&gt;$1=="S" {day[idx]=$3;stim[idx]=$4; scr[idx]=$8; prog[idx]=$5; opt[idx]=$9}&lt;BR /&gt;$1=="E" {if($3!=day[idx]) next&lt;BR /&gt;if(stim[idx]) etim[idx]=$4 }&lt;BR /&gt;END {for (r in etim) printf("script:%s prog:%s rt:%d-%d=%d opt=%s\n", scr[r],prog[r], etim[idx], stim[idx],etim[idx]-stim[idx], opt[idx])}' YOURFILE&lt;BR /&gt;&lt;BR /&gt;mfG Peter</description>
      <pubDate>Tue, 07 Aug 2007 11:21:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061439#M94302</guid>
      <dc:creator>Peter Nikitka</dc:creator>
      <dc:date>2007-08-07T11:21:09Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061440#M94303</link>
      <description>&lt;!--!*#--&gt;Hmmm,&lt;BR /&gt;&lt;BR /&gt;The prior solutions seem to subtract two HHMM values to get a duration. &lt;BR /&gt;That will result in 41 minutes going from 1259 to 1300 instead of the 1 minute one might reasonably expect.&lt;BR /&gt;Also, the prior solutions specifically remember stuff from the start record which is also available in the end record.&lt;BR /&gt;&lt;BR /&gt;I would suggest:&lt;BR /&gt;&lt;BR /&gt;$ awk -f test.awk test.txt&lt;BR /&gt;&lt;BR /&gt;where &lt;BR /&gt;----------- test.awk ----------&lt;BR /&gt;BEGIN { FS="|"; OFS=":" }&lt;BR /&gt;function minutes (time) { h = int(time/100); m = time - h*100; return h*60 + m }&lt;BR /&gt;/^S/ {s[$2]=$4}&lt;BR /&gt;/^E/ {print $8 " " $5,s[$2],$4,minutes($4)-minutes(s[$2])}&lt;BR /&gt;&lt;BR /&gt;Sample data&lt;BR /&gt;---------------- test.txt -----------&lt;BR /&gt;S|1161480|20070720|1259|createWebOrdFile.4ge|cronlog|.|test|| &lt;BR /&gt;E|1161480|20070720|1300|createWebOrdFile.4ge|cronlog|.|test|| &lt;BR /&gt;S|1161483|20070720|1205|createWebOrdFile.4ge|cronlog|.|xxxxxxxxxxxxx|| &lt;BR /&gt;S|1161484|20070720|1205|createWebOrdFile.4ge|cronlog|.|yyyyyyyyyyyyy|| &lt;BR /&gt;E|1161484|20070720|1255|createWebOrdFile.4ge|cronlog|.|aaaaaaaaaaaaa|| &lt;BR /&gt;E|1161483|20070720|1310|createWebOrdFile.4ge|cronlog|.|bbbbbbbbbbbbb|| &lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Results in:&lt;BR /&gt;--------------------------&lt;BR /&gt;test createWebOrdFile.4ge:1259:1300:1&lt;BR /&gt;aaaaaaaaaaaaa createWebOrdFile.4ge:1205:1255:50&lt;BR /&gt;bbbbbbbbbbbbb createWebOrdFile.4ge:1205:1310:65&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps some,&lt;BR /&gt;Hein van den Heuvel (at gmail dot com)&lt;BR /&gt;HvdH Performance Consulting&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Aug 2007 15:27:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061440#M94303</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-08-07T15:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: data manipulation</title>
      <link>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061441#M94304</link>
      <description>thanks guys,&lt;BR /&gt;&lt;BR /&gt;some good solutions here which I will use.&lt;BR /&gt;&lt;BR /&gt;Chris</description>
      <pubDate>Wed, 08 Aug 2007 03:09:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/data-manipulation/m-p/5061441#M94304</guid>
      <dc:creator>lawrenzo_1</dc:creator>
      <dc:date>2007-08-08T03:09:09Z</dc:date>
    </item>
  </channel>
</rss>

