<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: cat code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Thu, 24 Jul 2008 13:37:42 GMT</pubDate>
    <description>DZone Snippets: cat code</description>
    <item>
      <title>extract table names from sql log file</title>
      <link>http://snippets.dzone.com/posts/show/4639</link>
      <description>&lt;code&gt;&lt;br /&gt;grep "from " /var/log/mysql/mysqld.log | awk -Ffrom '{print $2}' | awk '{print $1}' | cat &gt; /home/shantanu/testing.txt&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 12 Oct 2007 08:23:02 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4639</guid>
      <author>shantanuo (shantanu oak)</author>
    </item>
    <item>
      <title>Ruby Cat</title>
      <link>http://snippets.dzone.com/posts/show/2326</link>
      <description>// A Simple Ruby cat program that includes using getoptlong and the rdoc.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!ruby&lt;br /&gt;# == Synopsis&lt;br /&gt;# Copies files to stdout&lt;br /&gt;#&lt;br /&gt;# == Usage&lt;br /&gt;# ruby cat.rb file1 file2 ... filen&lt;br /&gt;# &lt;br /&gt;# == Author&lt;br /&gt;# Scott LaBounty&lt;br /&gt;#&lt;br /&gt;# == Copyright&lt;br /&gt;# Copyright(c) 2006 Scott LaBounty&lt;br /&gt;#&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;require 'getoptlong'&lt;br /&gt;require 'rdoc/usage'&lt;br /&gt;&lt;br /&gt;##&lt;br /&gt;# Main Program&lt;br /&gt;#&lt;br /&gt;&lt;br /&gt;if __FILE__ == $0&lt;br /&gt;&lt;br /&gt;    # Set up the command line options&lt;br /&gt;    opts = GetoptLong.new(&lt;br /&gt;        ["--verbose", "-v", GetoptLong::NO_ARGUMENT],&lt;br /&gt;        ["--help", "-h", GetoptLong::NO_ARGUMENT]&lt;br /&gt;        )&lt;br /&gt;&lt;br /&gt;    # Set the default values for the options&lt;br /&gt;    verbose = false&lt;br /&gt;    date=""&lt;br /&gt;&lt;br /&gt;    # Parse the command line options. If we find one we don't recognize&lt;br /&gt;    # an exception will be thrown and we'll rescue with a RDoc::usage&lt;br /&gt;    begin&lt;br /&gt;        opts.each do | opt, arg|&lt;br /&gt;            case opt&lt;br /&gt;            when "--help"&lt;br /&gt;                RDoc::usage&lt;br /&gt;            when "--verbose"&lt;br /&gt;                verbose = true&lt;br /&gt;            end&lt;br /&gt;        end&lt;br /&gt;    rescue&lt;br /&gt;        RDoc::usage&lt;br /&gt;    end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    ARGV.each do | fileName |&lt;br /&gt;        puts "fileName = #{fileName}" if verbose&lt;br /&gt;&lt;br /&gt;        # Make sure the file exists&lt;br /&gt;        if (File.exist?(fileName)) then&lt;br /&gt;&lt;br /&gt;            # Open the file&lt;br /&gt;            File.open(fileName) do | file |&lt;br /&gt;&lt;br /&gt;                # For each line in the file &lt;br /&gt;                file.each_line do | line | &lt;br /&gt;                    puts "#{line}"&lt;br /&gt;                end&lt;br /&gt;&lt;br /&gt;            end&lt;br /&gt;        else&lt;br /&gt;            puts "Could not find #{fileName}"&lt;br /&gt;        end&lt;br /&gt;    end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 25 Jul 2006 19:34:00 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2326</guid>
      <author>slabounty (Scott LaBounty)</author>
    </item>
  </channel>
</rss>
