{
  "attachments": [],
  "comments_archived": true,
  "date": "2004-04-30T13:06:11.000Z",
  "excerpt": "I went a little nuts tonight with shell scripting.",
  "layout": "post",
  "tags": [
    "colophon"
  ],
  "title": "Fun with shell scripting",
  "wordpress_id": 517,
  "wordpress_slug": "fun-with-shell-scripting",
  "wordpress_url": "http://www.decafbad.com/blog/?p=517",
  "year": "2004",
  "month": "04",
  "day": "30",
  "isDir": false,
  "slug": "fun-with-shell-scripting",
  "type": "entry",
  "postName": "2004-04-30-fun-with-shell-scripting",
  "html": "<p>I went a little nuts tonight with shell scripting.  It started off with a few innocent bits of <a href=\"http://www.rt.com/man/cat.1.html\"><code>cat</code></a> and <a href=\"http://www.rt.com/man/grep.1.html\"><code>grep</code></a> piped together.  But then I invited trouble <a href=\"http://www.decafbad.com/cvs/*checkout*/www.decafbad.com/bin/parse_access_log\">started using</a> <a href=\"http://www.rt.com/man/sed.1.html\"><code>sed</code></a>.  Pretty soon, I was bringing in <a href=\"http://www.rt.com/man/cut.1.html\"><code>cut</code></a> and <a href=\"http://www.rt.com/man/sort.1.html\"><code>sort</code></a> and <a href=\"http://www.rt.com/man/uniq.1.html\"><code>uniq</code></a>.  I knew I was doomed when I made the whole mess <a href=\"http://www.decafbad.com/cvs/*checkout*/www.decafbad.com/bin/mail_500_400_report.sh\">start emailing me</a> with <a href=\"http://www.rt.com/man/sendmail.8.html\"><code>sendmail</code></a>.  </p>\n<p>Oh, but then I went completely off the deep end.  I looked up <a href=\"http://www.aaronsw.com/2002/rss30\">RSS 3.0</a>, since that's so much easier to generate on the fly.  I started producing that with a little help from <a href=\"http://www.rt.com/man/echo.1.html\"><code>echo</code></a> and <a href=\"http://www.rt.com/man/awk.1.html\"><code>awk</code></a>.  From there, I whipped up <a href=\"http://www.decafbad.com/cvs/*checkout*/www.decafbad.com/bin/rss300to091.py\">a quick v3.0 to v0.91 converter</a> so I could get something <a href=\"http://www.decafbad.com/cvs/dbagg2/\">my aggregator</a> could understand.</p>\n<p>It was all a very iterative process down a slippery slope of geekiness, and the resulting scripts are nothing that I'd've designed as such from scratch.  But, one thing led to another, and now I've got a <a href=\"http://www.decafbad.com/cvs/*checkout*/www.decafbad.com/bin/mail_500_400_report.sh\">nightly report emailed</a> to me of pages that have gone 404 and 500, and an <a href=\"http://www.decafbad.com/cvs/*checkout*/www.decafbad.com/bin/gen_referer_feed.sh\">RSS feed of referers</a> to boot.</p>\n<p>I'm sure it looks like completely braindead work, but it was fun!  </p>\n<div id=\"comments\" class=\"comments archived-comments\"><h3>Archived Comments</h3>\n<ul class=\"comments\">\n<li class=\"comment\" id=\"comment-221086528\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://msittig.wubi.org/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=a233a0b9bf67e939e7575b36e626744d&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\" width=\"\" height=\"\"></a>\n<a class=\"avatar name\" rel=\"nofollow\" href=\"http://msittig.wubi.org/\">Micah</a>\n</div>\n\n\n<p><a href=\"#comment-221086528\" class=\"permalink\"><time datetime=\"2004-04-30T09:21:59\">2004-04-30T09:21:59</time></a></p>\n</div>\n\n\n<div class=\"content\">Is \"sort | uniq\" the same as \"sort -u\" ?  Uniq is cool, though, I'd never seen it before.  And very nice scripts, it's (almost) always fun to read other peoples' code.</div>\n\n\n</li>\n<li class=\"comment\" id=\"comment-221086530\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://www.ulaluma.com/pyx\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=9e03aaf8edbe4b2c0d25e30ab9a69ffb&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\" width=\"\" height=\"\"></a>\n<a class=\"avatar name\" rel=\"nofollow\" href=\"http://www.ulaluma.com/pyx\">Donovan Preston</a>\n</div>\n\n\n<p><a href=\"#comment-221086530\" class=\"permalink\"><time datetime=\"2004-04-30T12:01:48\">2004-04-30T12:01:48</time></a></p>\n</div>\n\n\n<div class=\"content\">Haha. RSS 3.0 is awesome. Nothing like a little almost-rfc822 to knock some sense into the blogging world. How long has it been around? I never notice these things, I don't pay any attention to any of the blog world bullshit. (Maybe I should.)</div>\n\n\n</li>\n<li class=\"comment\" id=\"comment-221086531\">\n<div class=\"meta\">\n<div class=\"author\">\n<a class=\"avatar image\" rel=\"nofollow\" href=\"http://diveintomark.org/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=357a20e8c56e69d6f9734d23ef9517e8&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\" width=\"\" height=\"\"></a>\n<a class=\"avatar name\" rel=\"nofollow\" href=\"http://diveintomark.org/\">Mark</a>\n</div>\n\n\n<p><a href=\"#comment-221086531\" class=\"permalink\"><time datetime=\"2004-04-30T19:32:43\">2004-04-30T19:32:43</time></a></p>\n</div>\n\n\n<div class=\"content\">&gt; I don’t pay any attention to any of the blog world bullshit. (Maybe I should.)\nNo!  No, you shouldn't!  Do not, under any circumstances, get sucked into that grungy, petty, venom-soaked little world!  Anyone who knows what I'm talking about will back me up on this, including Les.</div>\n\n\n</li>\n</ul>\n\n\n</div>\n\n\n",
  "body": "I went a little nuts tonight with shell scripting.  It started off with a few innocent bits of [`cat`][cat] and [`grep`][grep] piped together.  But then I invited trouble [started using][parse_log] [`sed`][sed].  Pretty soon, I was bringing in [`cut`][cut] and [`sort`][sort] and [`uniq`][uniq].  I knew I was doomed when I made the whole mess [start emailing me][mail400report] with [`sendmail`][sendmail].  \r\n\r\nOh, but then I went completely off the deep end.  I looked up [RSS 3.0][rss30], since that's so much easier to generate on the fly.  I started producing that with a little help from [`echo`][echo] and [`awk`][awk].  From there, I whipped up [a quick v3.0 to v0.91 converter][rss300to091] so I could get something [my aggregator][dbagg2] could understand.\r\n\r\nIt was all a very iterative process down a slippery slope of geekiness, and the resulting scripts are nothing that I'd've designed as such from scratch.  But, one thing led to another, and now I've got a [nightly report emailed][mail400report] to me of pages that have gone 404 and 500, and an [RSS feed of referers][referrers_rss] to boot.\r\n\r\nI'm sure it looks like completely braindead work, but it was fun!  \r\n\r\n[echo]: http://www.rt.com/man/echo.1.html\r\n[awk]: http://www.rt.com/man/awk.1.html\r\n[sendmail]: http://www.rt.com/man/sendmail.8.html\r\n[cat]: http://www.rt.com/man/cat.1.html\r\n[grep]: http://www.rt.com/man/grep.1.html\r\n[sed]: http://www.rt.com/man/sed.1.html\r\n[cut]: http://www.rt.com/man/cut.1.html\r\n[sort]: http://www.rt.com/man/sort.1.html\r\n[uniq]: http://www.rt.com/man/uniq.1.html\r\n[referrers_rss]: http://www.decafbad.com/cvs/*checkout*/www.decafbad.com/bin/gen_referer_feed.sh\r\n[dbagg2]: http://www.decafbad.com/cvs/dbagg2/\r\n[rss300to091]: http://www.decafbad.com/cvs/*checkout*/www.decafbad.com/bin/rss300to091.py\r\n[parse_log]: http://www.decafbad.com/cvs/*checkout*/www.decafbad.com/bin/parse_access_log\r\n[mail400report]: http://www.decafbad.com/cvs/*checkout*/www.decafbad.com/bin/mail_500_400_report.sh\r\n[rss30]: http://www.aaronsw.com/2002/rss30\r\n\r\n<div id=\"comments\" class=\"comments archived-comments\">\r\n            <h3>Archived Comments</h3>\r\n            \r\n        <ul class=\"comments\">\r\n            \r\n        <li class=\"comment\" id=\"comment-221086528\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://msittig.wubi.org/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=a233a0b9bf67e939e7575b36e626744d&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\"/></a>\r\n                    <a class=\"avatar name\" rel=\"nofollow\" \r\n                       href=\"http://msittig.wubi.org/\">Micah</a>\r\n                </div>\r\n                <a href=\"#comment-221086528\" class=\"permalink\"><time datetime=\"2004-04-30T09:21:59\">2004-04-30T09:21:59</time></a>\r\n            </div>\r\n            <div class=\"content\">Is \"sort | uniq\" the same as \"sort -u\" ?  Uniq is cool, though, I'd never seen it before.  And very nice scripts, it's (almost) always fun to read other peoples' code.</div>\r\n            \r\n        </li>\r\n    \r\n        <li class=\"comment\" id=\"comment-221086530\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://www.ulaluma.com/pyx\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=9e03aaf8edbe4b2c0d25e30ab9a69ffb&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\"/></a>\r\n                    <a class=\"avatar name\" rel=\"nofollow\" \r\n                       href=\"http://www.ulaluma.com/pyx\">Donovan Preston</a>\r\n                </div>\r\n                <a href=\"#comment-221086530\" class=\"permalink\"><time datetime=\"2004-04-30T12:01:48\">2004-04-30T12:01:48</time></a>\r\n            </div>\r\n            <div class=\"content\">Haha. RSS 3.0 is awesome. Nothing like a little almost-rfc822 to knock some sense into the blogging world. How long has it been around? I never notice these things, I don't pay any attention to any of the blog world bullshit. (Maybe I should.)</div>\r\n            \r\n        </li>\r\n    \r\n        <li class=\"comment\" id=\"comment-221086531\">\r\n            <div class=\"meta\">\r\n                <div class=\"author\">\r\n                    <a class=\"avatar image\" rel=\"nofollow\" \r\n                       href=\"http://diveintomark.org/\"><img src=\"http://www.gravatar.com/avatar.php?gravatar_id=357a20e8c56e69d6f9734d23ef9517e8&amp;size=32&amp;default=http://mediacdn.disqus.com/1320279820/images/noavatar32.png\"/></a>\r\n                    <a class=\"avatar name\" rel=\"nofollow\" \r\n                       href=\"http://diveintomark.org/\">Mark</a>\r\n                </div>\r\n                <a href=\"#comment-221086531\" class=\"permalink\"><time datetime=\"2004-04-30T19:32:43\">2004-04-30T19:32:43</time></a>\r\n            </div>\r\n            <div class=\"content\">> I don’t pay any attention to any of the blog world bullshit. (Maybe I should.)\r\n\r\nNo!  No, you shouldn't!  Do not, under any circumstances, get sucked into that grungy, petty, venom-soaked little world!  Anyone who knows what I'm talking about will back me up on this, including Les.</div>\r\n            \r\n        </li>\r\n    \r\n        </ul>\r\n    \r\n        </div>\r\n    ",
  "parentPath": "./content/posts/archives/2004",
  "path": "2004/04/30/fun-with-shell-scripting",
  "needsBuild": true,
  "prevPostPath": "2004/04/29/has-it-been-quiet",
  "prevPostTitle": "Has it been quiet?",
  "nextPostPath": "2004/05/02/feed-validation-confusion",
  "nextPostTitle": "Feed validation confusion"
}