<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: grep code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Fri, 16 May 2008 14:44:11 GMT</pubDate>
    <description>DZone Snippets: grep code</description>
    <item>
      <title>LoadRunner grep statements for errors</title>
      <link>http://snippets.dzone.com/posts/show/5261</link>
      <description>&lt;code&gt;&lt;br /&gt;grep -rnE "Error|Warning|error|warning" * | grep \.html  | grep "&lt;TITLE&gt;Error"&lt;br /&gt;&lt;br /&gt;grep -rnEA10 "Error|Warning|error|warning" * | grep \.html  | grep -E "&lt;b&gt;"&lt;br /&gt;&lt;br /&gt;grep -rnEA200 "0\-0" * | grep \.html | grep -E "advertiserId"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 19 Mar 2008 22:07:14 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5261</guid>
      <author>90kts (koops)</author>
    </item>
    <item>
      <title>Count line of code</title>
      <link>http://snippets.dzone.com/posts/show/4870</link>
      <description>// Use wc to count lines &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;check out goes here&lt;br /&gt;cd dir&lt;br /&gt;grep -r "*;*" * | wc -l&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 11 Dec 2007 01:04:29 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4870</guid>
      <author>aniline (Aniline)</author>
    </item>
    <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>Parse Exim log file with SpamAssassin score</title>
      <link>http://snippets.dzone.com/posts/show/4590</link>
      <description>&lt;code&gt;&lt;br /&gt;grep '\[Spam score: [1-9]' /var/log/exim/main.log | awk '{print $3}' | xargs -t -i grep {} /var/log/exim/main.log &gt; /var/log/exim/spam_score.log&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;grep 'reporter\.pl' /var/log/exim/main.log | awk '{print $3}' | xargs -t -i grep {} /var/log/exim/main.log &gt; /var/log/exim/spam_reporter.pl.log&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sat, 29 Sep 2007 08:50:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4590</guid>
      <author>Wallace (Wallace)</author>
    </item>
    <item>
      <title>email addresses using egrep</title>
      <link>http://snippets.dzone.com/posts/show/4582</link>
      <description>// email addresses&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;egrep "\w+([._-]\w)*@\w+([._-]\w)*\.\w{2,4}"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Fri, 28 Sep 2007 03:19:19 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4582</guid>
      <author>shantanuo (shantanu oak)</author>
    </item>
    <item>
      <title>unix wizards of the realm:</title>
      <link>http://snippets.dzone.com/posts/show/4432</link>
      <description>// SVN ignore based on .cvsignore file:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;svn propset svn:ignore -F .cvsignore .&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// grep:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  &#8230; with line number: -n&lt;br /&gt;  &#8230; with file name: -H&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// os x housekeeping:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// install perl module:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;sudo perl -MCPAN -e 'install Bundle::LWP'&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// meta refresh (i have never typed this line start to finish in my life. i have probably copy-pasted it 7,000 times&lt;br /&gt;&lt;code&gt;&lt;br /&gt;&lt;meta http-equiv=Refresh content="0; URL=http://blog.jm3.net/" /&gt;&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// get files off codeswami:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ssh -l cs 208.101.26.91&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;// SQL tricks:&lt;br /&gt;http://jm3.net/cgi-bin/safe/wiki.pl?MySqlLibrary&lt;br /&gt;</description>
      <pubDate>Sun, 19 Aug 2007 17:34:54 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4432</guid>
      <author>jm3 (john manoogian III)</author>
    </item>
    <item>
      <title>Twitter bot weatherlisbon</title>
      <link>http://snippets.dzone.com/posts/show/4159</link>
      <description>This little bash script shows how to use curl, grep, tail, sed and perl one-liners in order to compose a bleeding-edge twitter bot.&lt;br /&gt;This one returns daily weather forecasts for Lisbon city based on the BBC weather forecast rss feed.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;#! /bin/sh&lt;br /&gt;&lt;br /&gt;#Goto here&lt;br /&gt;here=/home/guillaume/Personal&lt;br /&gt;cd $here&lt;br /&gt;&lt;br /&gt;#BBC Lisbon weather id&lt;br /&gt;id=0048&lt;br /&gt;&lt;br /&gt;#BBC weather RSS feed address&lt;br /&gt;feed="http://feeds.bbc.co.uk/weather/feeds/rss/5day/world/${id}.xml"&lt;br /&gt;&lt;br /&gt;#City&lt;br /&gt;city=lisbon&lt;br /&gt;&lt;br /&gt;#temporary file&lt;br /&gt;file="weather${city}"&lt;br /&gt;&lt;br /&gt;#Weather twitter bot&lt;br /&gt;twitbot=weatherlisbon:*******&lt;br /&gt;&lt;br /&gt;#Timestamp the log file&lt;br /&gt;echo .&gt;&gt; $file.log&lt;br /&gt;date &gt;&gt; $file.log&lt;br /&gt;&lt;br /&gt;#Read the RSS feed and filter it&lt;br /&gt;curl $feed | grep 'title' | tail -n 1 | perl -wlne'm/title&gt;(.*)&lt;\/title/i &amp;&amp; print $1' | sed -e "s/&amp;#xB0;//g" &gt; $file.txt&lt;br /&gt;&lt;br /&gt;#Read the forecast into a weather variable&lt;br /&gt;read weather &lt; $file.txt&lt;br /&gt;&lt;br /&gt;#Twit the weather variable away&lt;br /&gt;curl --basic --user $twitbot --data status="$weather" http://twitter.com/statuses/update.xml &gt;&gt; $file.log&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 18 Jun 2007 21:37:40 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4159</guid>
      <author>griflet (guillaume riflet)</author>
    </item>
    <item>
      <title>grep for a file, excluding svn metadata directories and files</title>
      <link>http://snippets.dzone.com/posts/show/3707</link>
      <description>Grep for something, excluding the annoying svn metadata (.svn**)&lt;br /&gt;The find piece could also be used for more general tasks -- just remove the pipe and take a look at the output to see if it will work for you.&lt;br /&gt;I tried (and failed) to use the find to a path preserving copy from within a subdirectory in a checkout...though there must be a way.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;find . -path '*/.svn' -prune -o -type f -print | xargs -e grep -I -n -e PATTERN&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 20 Mar 2007 15:13:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3707</guid>
      <author>rsanheim (Rob Sanheim)</author>
    </item>
    <item>
      <title>Find and replace</title>
      <link>http://snippets.dzone.com/posts/show/3416</link>
      <description>This will search all files recursively for SEARCH_STRING and replace all occurrences of SEARCH_STRING with REPLACE_STRING throughout each unique file found. It also creates a backup of each modified file so that FILE is backed-up as FILE~ (with a tilde).&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;grep -R --files-with-matches 'SEARCH_STRING' . | sort | uniq | xargs perl -pi~ -e 's/SEARCH_STRING/REPLACE_STRING/'&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 06 Feb 2007 01:07:43 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3416</guid>
      <author>seanmurphy (Sean Murphy)</author>
    </item>
    <item>
      <title>search with grep in linux</title>
      <link>http://snippets.dzone.com/posts/show/2688</link>
      <description>&lt;br /&gt;Searching files&lt;br /&gt;&lt;br /&gt;grep (r - recursive, s - no messages, n -line number, i - case insensitve, H -with filename)&lt;br /&gt;&lt;code&gt;&lt;br /&gt;grep -rsniH your_string&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;match lines containing the string "I am a cat" or the string "I am a dog".&lt;br /&gt;&lt;code&gt;&lt;br /&gt;grep "I am a \(cat\|dog\)" &lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Search application&lt;br /&gt;&lt;br /&gt;to find PID (process ID) of a certain application or process,&lt;br /&gt;&lt;code&gt;&lt;br /&gt;pgrep&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;find application port&lt;br /&gt;&lt;code&gt;&lt;br /&gt;netstat -a | grep ftp&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;</description>
      <pubDate>Sat, 23 Sep 2006 18:11:26 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2688</guid>
      <author>nevadalife (nevada)</author>
    </item>
  </channel>
</rss>
