<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: bash code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sat, 06 Sep 2008 22:54:04 GMT</pubDate>
    <description>DZone Snippets: bash code</description>
    <item>
      <title>Reads log files</title>
      <link>http://snippets.dzone.com/posts/show/4880</link>
      <description>// Map directory structure and then read logs extract results.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;!#/usr/bin/bash&lt;br /&gt;&lt;br /&gt;for line in `ls /netapp/XXXXXX0/XXXXXX_logs`&lt;br /&gt;	do &lt;br /&gt;	for line2 in `ls  /netapp/XXXXXX0/XXXXXX_logs/$line`&lt;br /&gt;			do  echo /netapp/XXXXXX0/XXXXXX_logs/$line/$line2 &lt;br /&gt;	done	&lt;br /&gt;done | grep 2007-11-29 &gt; results.dat&lt;br /&gt;&lt;br /&gt;!#/usr/bin/bash&lt;br /&gt;for res in `cat results.dat`&lt;br /&gt; do&lt;br /&gt; echo -n $res &lt;br /&gt; echo -n " "&lt;br /&gt; grep -c ",i," $res/*&lt;br /&gt;done&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 12 Dec 2007 23:38:24 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4880</guid>
      <author>aniline (Aniline)</author>
    </item>
    <item>
      <title>Sed substitution</title>
      <link>http://snippets.dzone.com/posts/show/4869</link>
      <description>// Sed used to replace a string&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;for line in `ls`&lt;br /&gt;do&lt;br /&gt;        sed -e 's/Spring/Regular Season/g' line &gt; tmp&lt;br /&gt;        mv tmp line&lt;br /&gt;        echo -n $line&lt;br /&gt;        grep Regular $line&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 11 Dec 2007 01:01:05 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4869</guid>
      <author>aniline (Aniline)</author>
    </item>
    <item>
      <title>Email in Bash</title>
      <link>http://snippets.dzone.com/posts/show/4868</link>
      <description>//Bash email&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;function email&lt;br /&gt;{&lt;br /&gt;echo "this is a test" | mail -s "test" "$1"&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if [ "$1" = "" ]; then&lt;br /&gt;echo "nothing in param"&lt;br /&gt;else&lt;br /&gt;echo "sending mail"&lt;br /&gt;&lt;br /&gt;#emailing attachment&lt;br /&gt;#uuencode statsNbaAllStarSim statssim | mail -s "test attachement" atayebali@foxsports.com&lt;br /&gt;#uuencode &lt;filename that will be send&gt; &lt;name for attached file that is sent&gt; |&lt;br /&gt;&lt;br /&gt;#passing the param to function&lt;br /&gt;email $1&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 11 Dec 2007 00:58:01 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4868</guid>
      <author>aniline (Aniline)</author>
    </item>
  </channel>
</rss>
