<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Axelilly's Ponderings &#187; gawk</title>
	<atom:link href="http://axelilly.wordpress.com/tag/gawk/feed/" rel="self" type="application/rss+xml" />
	<link>http://axelilly.wordpress.com</link>
	<description>Just my thoughts and notes on various topics.</description>
	<lastBuildDate>Wed, 01 Jul 2009 15:12:07 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='axelilly.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/825b1e6ed39e7f92aeef0fbaade338dc?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Axelilly's Ponderings &#187; gawk</title>
		<link>http://axelilly.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://axelilly.wordpress.com/osd.xml" title="Axelilly&#8217;s Ponderings" />
		<item>
		<title>Received fax report for Hylafax using GAWK.</title>
		<link>http://axelilly.wordpress.com/2009/01/21/received-fax-report-for-hylafax-using-gawk/</link>
		<comments>http://axelilly.wordpress.com/2009/01/21/received-fax-report-for-hylafax-using-gawk/#comments</comments>
		<pubDate>Wed, 21 Jan 2009 19:17:17 +0000</pubDate>
		<dc:creator>axelilly</dc:creator>
				<category><![CDATA[TechTips]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[gawk]]></category>
		<category><![CDATA[hylafax]]></category>

		<guid isPermaLink="false">http://axelilly.wordpress.com/?p=63</guid>
		<description><![CDATA[I like using the open source fax server software Hylafax for deploying fax services to a network.
One of the great things about using Hylafax for fax services, is the great flexibility you get.  Lately, one of my users requested that I create a report that could be automatically sent to her group daily.  This report [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axelilly.wordpress.com&blog=1791500&post=63&subd=axelilly&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I like using the open source fax server software <a title="HylaFax" href="http://www.hylafax.org" target="_blank">Hylafax</a> for deploying fax services to a network.</p>
<p>One of the great things about using Hylafax for fax services, is the great flexibility you get.  Lately, one of my users requested that I create a report that could be automatically sent to her group daily.  This report was to show all faxes that were sent to their inbound fax number during the previous day.  In particular they wanted to be able to look for any faxes that someone had tried to send to them that failed for some reason.</p>
<p>I decied to use <a title="GAWK page." href="http://www.gnu.org/software/gawk/" target="_blank">GAWK</a> in order to parse the transfer log and create the resulting report.  Then, I wrapped this gawk script in a little bash script to add a little functionality.  Finally, this bash script was added to cron.daily, so as to produce the report and email it on a daily basis.</p>
<p>Simply change <strong>YOURFAXNUMBERHERE</strong> to be what receiving fax number you want to report on.  Finally you&#8217;ll want to pipe the output to <em>mail</em> if you want it to get emailed automatically.  I&#8217;m sure there are numerous better ways to make the format better, etc.  However, this is my quick script and it works perfectly for my needs.  Let me know if you find it useful.</p>
<p>#!/bin/bash</p>
<p>#####################################<br />
# faxrecreport.sh<br />
#<br />
# Written by: Jason Fenner<br />
#<br />
# V 1.0<br />
#<br />
# 01/21/2009<br />
#<br />
# This report will print out all<br />
# recv&#8217;d faxes for a certain inbound<br />
# fax number that was received<br />
# in the last 24 hour period.<br />
#<br />
####################################</p>
<p>DATEPERIOD=`date &#8211;date=yesterday +%D`<br />
FAXNUMBER=&#8221;YOURFAXNUMBERHERE&#8221;</p>
<p>echo &#8220;Fax Receive Report&#8221;<br />
echo<br />
echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8221;<br />
echo &#8220;Fax Number: $FAXNUMBER&#8221;<br />
echo &#8220;24 Hour Period for: $DATEPERIOD&#8221;<br />
echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8221;<br />
echo<br />
echo</p>
<p>awk -F&#8217;\t&#8217; &#8216;BEGIN{ &#8220;date &#8211;date=yesterday +%D &#8221; | \<br />
getline dateVal; printf(&#8220;%15s%30s%15s%7s %8s%50s %12s\n&#8221;,&#8221;Date&#8221;,&#8221;Name&#8221;,&#8221;CallerID&#8221;,&#8221;Pages&#8221;,&#8221;Duration&#8221;,&#8221;Error&#8221;,&#8221;Ref&#8221;); \<br />
for (x=1; x&lt;=140; ++x) {printf( &#8220;%s&#8221; , &#8220;-&#8221; ) } \<br />
print &#8220;&#8221; }<br />
($2 ~ /RECV/ &amp;&amp; $16 ~ /YOURFAXNUMBERHERE/ &amp;&amp; $1 ~ dateVal) \<br />
{gsub(/\&#8221;/,&#8221;"); if ($14 == &#8220;&#8221;) $14 = &#8220;None&#8221;; \<br />
if ($15 == &#8220;&#8221;) $15 = &#8220;Not Received&#8221;; \<br />
printf(&#8220;%15s%30s%15s%7s %8s%50s %12s\n&#8221;, $1,$9,$15,$11,$13,$14,$3)<br />
}</p>
<p>END{ for (x=1; x&lt;=140; ++x) {printf( &#8220;%s&#8221; , &#8220;-&#8221; ) } \<br />
print &#8220;&#8221; }&#8217; /var/spool/hylafax/etc/xferfaxlog</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/axelilly.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/axelilly.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/axelilly.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/axelilly.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/axelilly.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/axelilly.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/axelilly.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/axelilly.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/axelilly.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/axelilly.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=axelilly.wordpress.com&blog=1791500&post=63&subd=axelilly&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://axelilly.wordpress.com/2009/01/21/received-fax-report-for-hylafax-using-gawk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0d0afaebdcff6a0581f567fd6c7f8a40?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">axelilly</media:title>
		</media:content>
	</item>
	</channel>
</rss>