<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://townx.org" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>townx - A script for parsing work log files - Comments</title>
 <link>http://townx.org/blog/elliot/script-parsing-work-log-files</link>
 <description>Comments for &quot;A script for parsing work log files&quot;</description>
 <language>en</language>
<item>
 <title>Cool algoritm and schedule</title>
 <link>http://townx.org/blog/elliot/script-parsing-work-log-files#comment-40309</link>
 <description>&lt;p&gt;Cool algoritm and schedule&lt;/p&gt;</description>
 <pubDate>Tue, 02 Feb 2010 07:39:53 -0600</pubDate>
 <dc:creator>cincin perak</dc:creator>
 <guid isPermaLink="false">comment 40309 at http://townx.org</guid>
</item>
<item>
 <title>thanks</title>
 <link>http://townx.org/blog/elliot/script-parsing-work-log-files#comment-40278</link>
 <description>&lt;p&gt;Thank you for this beautiful service from your blog every day and I always read in and help me get the important things I am. microsoft and google search does not return in technology anymore now that new doors were opened the most important factor of course quality webmasters. as well as useful internet useless on the internet is not internet be useful from the useless key value can not be understood given the opportunity to thank you for writing. &lt;a href=&quot;http://www.fullpornoizle.net&quot; title=&quot;http://www.fullpornoizle.net&quot;&gt;http://www.fullpornoizle.net&lt;/a&gt;&lt;/p&gt;</description>
 <pubDate>Sat, 23 Jan 2010 15:08:02 -0600</pubDate>
 <dc:creator>Guest</dc:creator>
 <guid isPermaLink="false">comment 40278 at http://townx.org</guid>
</item>
<item>
 <title>cute script!</title>
 <link>http://townx.org/blog/elliot/script-parsing-work-log-files#comment-40224</link>
 <description>&lt;p&gt;I love things that make lists.. this looks really useful.. must be my virgo tendancies coming out!&lt;/p&gt;</description>
 <pubDate>Thu, 31 Dec 2009 19:30:58 -0600</pubDate>
 <dc:creator>Auto Approved Blogs</dc:creator>
 <guid isPermaLink="false">comment 40224 at http://townx.org</guid>
</item>
<item>
 <title>good job</title>
 <link>http://townx.org/blog/elliot/script-parsing-work-log-files#comment-40209</link>
 <description>&lt;p&gt;Interesting script. I always learn a lot from your posts and really appreciate it! I wish you a Happy New Year. Regards, Martin&lt;/p&gt;</description>
 <pubDate>Mon, 28 Dec 2009 07:17:34 -0600</pubDate>
 <dc:creator>swarovski strass</dc:creator>
 <guid isPermaLink="false">comment 40209 at http://townx.org</guid>
</item>
<item>
 <title>A script for parsing work log files</title>
 <link>http://townx.org/blog/elliot/script-parsing-work-log-files</link>
 <description>&lt;p&gt;Attached is my Ruby script for parsing log files I keep at work. I have to complete a weekly report, and this forms the basis of that; as I don&#039;t keep regular office hours (I flexi-work around child care), it also helps me keep track of the hours I&#039;ve worked.&lt;/p&gt;

&lt;p&gt;The basic principle of operation is as follows:&lt;/p&gt;


&lt;ol&gt;
&lt;li&gt;I create a file for each working week, called something like week45.log&lt;/li&gt;
&lt;li&gt;During the week, I record bits of activity I do (see below); I also note down stuff I plan to do next (again, see below)&lt;/li&gt;
&lt;li&gt;At the end of the week, I run &lt;code&gt;parse_work_log &amp;lt;file name&amp;gt; &amp;gt; summary.out&lt;/code&gt; on the file to produce a log of what I&#039;ve done&lt;/li&gt;
&lt;li&gt;If anything goes wrong, I tend to edit the work log and regenerate, so I can just keep the log (not the summary)&lt;/li&gt;
&lt;li&gt;I cut and paste from the &lt;code&gt;summary.out&lt;/code&gt; file into an email I send round&lt;/li&gt;
&lt;/ol&gt;



&lt;p&gt;The format of the file is deliberately simple to make it easy to maintain; there are a handful of formatting rules. An example is shown below.&lt;/p&gt;



&lt;pre&gt;
**********
2009-12-21

09:30-12:00    Researching this and that #research
12:00-13:00    -Lunch
13:00-14:00    More research
14:00-18:00    Writing some application #coding

**********
2009-12-22

09:30-10:00    Admin #Admin
10:00-10:15    -Break
10:00-12:00    Found out something rather marvellous #Very important research
12:00-12:45    -Lunch
12:45-18:00    Writing another application #coding

**********
+NEXT Have lots of fun banging my head on a brick wall
+NEXT Reinstall my operating system
&lt;/pre&gt;



&lt;p&gt;Which, when parsed, produces this on stderr:&lt;/p&gt;



&lt;pre&gt;
*************************************

Worked 15.25 hours
&lt;/pre&gt;



&lt;p&gt;And this on stdout:&lt;/p&gt;



&lt;pre&gt;
*************************************
This week:

Admin:

  * Admin

Very important research:

  * Found out something rather marvellous

coding:

  * Writing some application
  * Writing another application

research:

  * Researching this and that

*************************************
Next:

  * Have lots of fun banging my head on a brick wall
  * Reinstall my operating system
&lt;/pre&gt;



&lt;p&gt;Notes on formatting:&lt;/p&gt;


&lt;ul&gt;
&lt;li&gt;The asterisks and dates are just there to make it more readable - they&#039;re basically ignored&lt;/li&gt;
&lt;li&gt;An entry is a single line with the format &lt;code&gt;HH:MM-HH:MM &amp;lt;...whitespace...&amp;gt; &amp;lt;text&amp;gt; &amp;lt;#optional tag&amp;gt;\n&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;The time span for an entry is added to the total time, unless the entry text contains &lt;code&gt;-Lunch&lt;/code&gt; or &lt;code&gt;-Break&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;#&lt;/code&gt; creates a tagged entry which gets included in the report; it appears as a bullet point with the tag as its heading; any entries with the same tag get aggregated under a single heading; tags and entries appear in the order they occur in the file&lt;/li&gt;
&lt;li&gt;Any line starting with &lt;code&gt;+NEXT&lt;/code&gt; gets listed in the &lt;em&gt;Next&lt;/em&gt; section at the end; tags don&#039;t work on this (could, but don&#039;t at the moment)&lt;/li&gt;
&lt;/ul&gt;



&lt;p&gt;It is pretty primitive, but it does the job for me.&lt;/p&gt;

&lt;p&gt;Installation: there isn&#039;t any, really. It works from the command line and needs Ruby. The licence? &lt;span class=&quot;caps&quot;&gt;BSD,&lt;/span&gt; I guess.&lt;/p&gt;</description>
 <comments>http://townx.org/blog/elliot/script-parsing-work-log-files#comments</comments>
 <category domain="http://townx.org/tech">tech</category>
 <category domain="http://townx.org/code">code</category>
 <enclosure url="http://townx.org/files/parse_work_log" length="1669" type="application/octet-stream" />
 <pubDate>Wed, 23 Dec 2009 18:20:05 -0600</pubDate>
 <dc:creator>elliot</dc:creator>
 <guid isPermaLink="false">789 at http://townx.org</guid>
</item>
</channel>
</rss>
