<?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/"
> <channel><title>gHacks Technology News &#124; Latest Tech News, Software And Tutorials &#187; regular expressions</title> <atom:link href="http://www.ghacks.net/tag/regular-expressions/feed/" rel="self" type="application/rss+xml" /><link>http://www.ghacks.net</link> <description>A technology news blog covering software, mobile phones, gadgets, security, the Internet and other relevant areas.</description> <lastBuildDate>Sat, 11 Feb 2012 17:32:23 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/> <item><title>Get to know Linux: Using grep</title><link>http://www.ghacks.net/2010/09/06/get-to-know-linux-using-grep/</link> <comments>http://www.ghacks.net/2010/09/06/get-to-know-linux-using-grep/#comments</comments> <pubDate>Mon, 06 Sep 2010 11:49:54 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[file search]]></category> <category><![CDATA[grep]]></category> <category><![CDATA[LCI]]></category> <category><![CDATA[linux command line]]></category> <category><![CDATA[regular expressions]]></category> <category><![CDATA[search files]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=33971</guid> <description><![CDATA[If you use Linux long enough, you are going to wind up getting to know (and using) the command line. And if you use the command line long enough, you are going to find yourself using the grep tool. Grep is one of the most useful linux utilities in that it will search WITHIN a [...]]]></description> <content:encoded><![CDATA[<p>If you use Linux long enough, you are going to wind up getting to know (and using) the command line. And if you use the command line long enough, you are going to find yourself using the <em>grep</em> tool. Grep is one of the most useful linux utilities in that it will search WITHIN a text file for a string of characters. Grep is such a useful tool that it is often used in shell scripts and much, much more.</p><p>In this article I am going to introduce you to the <em>grep </em> command and how it is used. Once you know this command, your life with the Linux command line will be made much easier.</p><p><span
id="more-33971"></span><strong>Limitations</strong></p><p>Although grep is a very versatile command to know, it does have its limitations. One of the biggest limitations it has is that it can not search within binary files. That&#8217;s all fine, because your typical binary file would be searchable with the application that created said binary file.</p><p>Grep also has a line limit of 2048 lines. This means if your file is beyond that, grep will stop searching at the line limit.</p><p><strong>Installation</strong></p><p>You are in luck. Grep is a tool that comes pre-installed with all Linux distributions. So no installation is required.</p><p><strong>Usage</strong></p><p>The basic usage of <em>grep </em>is:</p><p><em>grep [OPTIONS] [PATTERN] file</em></p><p>Their are numerous options to use with the Grep command. The more helpful of these options are:</p><p><code>-E Interpret the PATTERN section as an extended regular expression.<br
/> -P Interpret the PATTERN section as a Perl regular expression.<br
/> -e Use PATTERN as the pattern. If searching a single PATTERN you do not need the -e option. But this option allows you to search for multiple search patterns.<br
/> -f  Obtain patterns from a file, one per line.<br
/> -i Ignore case.<br
/> -c Suppress normal output and only output count of matching lines.<br
/> --color Display the matched strings in color.<br
/> -n Display the line number associated with the matching entry.</code></p><p><strong>Examples</strong></p><p>Let&#8217;s take a look at a very basic example first. You want to search the file <strong>/etc/test.conf</strong> for the string <em>input</em>. The grep command for this would be:</p><p><code>grep input /etc/test.conf</code></p><p>Now, let&#8217;s say that <strong>test.conf</strong> is a larger file and you need to know the line number the string <em>input</em> is on. For this the command would look like:</p><p><code>grep -n input /etc/test.conf</code></p><p>The above output would then include the line number associated with each matching entry. Now, let&#8217;s say you wanted to search the same file for both <em>input </em>and <em>output </em>and you want to know the line numbers associated with each. For this the command would look like:</p><p><code>grep -n -e input -e output /etc/test.conf</code></p><p>But what if you only want to know how many times the string <em>input</em> is found in the file <strong>/etc/test.conf</strong>. For this you could use the command like so:</p><p><code>grep -c input /etc/test.conf</code></p><p><strong>Final thoughts</strong></p><p>Grep is one of those commands that you will use time and again, in many, various ways. I always tell new users that, once you reach the point where you begin using the command line, <em>grep </em>is one of the first commands you should master.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2010/09/06/get-to-know-linux-using-grep/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Power searching Linux with SearchMonkey</title><link>http://www.ghacks.net/2009/09/30/power-searching-linux-with-searchmonkey/</link> <comments>http://www.ghacks.net/2009/09/30/power-searching-linux-with-searchmonkey/#comments</comments> <pubDate>Wed, 30 Sep 2009 18:54:24 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Desktop Manager]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[desktop searching]]></category> <category><![CDATA[regular expressions]]></category> <category><![CDATA[search]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=16820</guid> <description><![CDATA[There are search tools and then there are SEARCH TOOLS. Any Linux user that has ever needed real power for their searches generally has to resort to the command line where they can take advantage of regular expressions or scripting. But what if you could have a GUI tool that could also handle regular expressions? [...]]]></description> <content:encoded><![CDATA[<p>There are search tools and then there are SEARCH TOOLS. Any Linux user that has ever needed real power for their searches generally has to resort to the command line where they can take advantage of regular expressions or scripting. But what if you could have a GUI tool that could also handle regular expressions?</p><p>There is such a tool &#8211; <a
title="SearchMonkey" href="http://searchmonkey.embeddediq.com" target="_blank">SearchMonkey</a>. SearchMonkey attempts to bridge the gap between Beagle and locate/find by adding a powerful regular expression builder to a GUI searching tool. And SearchMonkey does quite well at this task.</p><p>In this article you will learn how to install SearchMonkey and use its powerful regular expression builder to power your searches.</p><p><span
id="more-16820"></span><strong>Installing</strong></p><p>As you have come to expect, installing SearchMonkey is simple:</p><ol><li><span
style="background-color: #ffffff">Open up the Add/Remove Software application.</span></li><li><span
style="background-color: #ffffff">Search for &#8220;searchmonkey&#8221; (No quotes).</span></li><li><span
style="background-color: #ffffff">Select SearchMonkey for installation.</span></li><li><span
style="background-color: #ffffff">Click Apply.</span></li><li><span
style="background-color: #ffffff">Enjoy.</span></li></ol><p>Once SearchMonkey is installed you will find it in the Accessories sub-menu of the Applications menu.</p><p><strong>Using SearchMonkey</strong></p><div
id="attachment_16828" class="wp-caption alignleft" style="width: 287px"><a
rel="attachment wp-att-16828" href="http://www.ghacks.net/2009/09/30/power-searching-linux-with-searchmonkey/searchmonkey_advanced/"><img
class="size-full wp-image-16828  " src="http://www.ghacks.net/wp-content/uploads/2009/09/searchmonkey_advanced.png" alt="Figure 1" width="277" height="222" /></a><p
class="wp-caption-text">Figure 1</p></div><p>When you fire up the SearchMonkey tool the main window will appear (see Figure 1) with three tabs: Basic, Advanced, and Options. For standard searching the Basic tab should be fine. You can not add regular expressions to the Basic tab. Only within the Advanced tab can you take advantage of regular expressions in your searching.</p><p>And since anyone can use a basic search GUI, let&#8217;s skip right to the good stuff within the Advanced tab.</p><p><strong>Advanced searching</strong></p><div
id="attachment_16829" class="wp-caption alignright" style="width: 286px"><a
rel="attachment wp-att-16829" href="http://www.ghacks.net/2009/09/30/power-searching-linux-with-searchmonkey/searchmonkey/"><img
class="size-full wp-image-16829  " src="http://www.ghacks.net/wp-content/uploads/2009/09/searchmonkey.png" alt="Figure 2" width="276" height="219" /></a><p
class="wp-caption-text">Figure 2</p></div><p>When you click on the Advanced tab you will see the regular expression builder right away (see Figure 2). As you can see you can apply regular expressions to the both the f<span
style="background-color: #ffffff">ile name and the file contents. Let&#8217;s walk through the process of creating a regular expression for a search. I want to search all files within <strong>/home/jlwallen</strong> for any file containing the phrase &#8220;Figure&#8221; more than once. To do this click on the Expression Builder button for the &#8220;Containing&#8221; section. When this is clicked this it will open up a new window where the expression can be built. </span></p><p><span
style="background-color: #ffffff"> </span></p><div
id="attachment_16831" class="wp-caption alignleft" style="width: 435px"><a
rel="attachment wp-att-16831" href="http://www.ghacks.net/2009/09/30/power-searching-linux-with-searchmonkey/searchmonkeyp_builder/"><img
class="size-full wp-image-16831 " src="http://www.ghacks.net/wp-content/uploads/2009/09/searchmonkeyp_builder.png" alt="Figure 3" width="425" height="188" /></a><p
class="wp-caption-text">Figure 3</p></div><p>Here&#8217;s how we build our expression. Since our expression will only apply to the contents of the files click the Expression Builder button for the &#8220;Contains&#8221; section. When the new window appears (see Figure 3) immediately go to the &#8220;Text contains&#8221; section and select &#8220;The phrase&#8221; from the drop down. In the text area immediately to the right of that drop down enter  &#8221;Figure&#8221; (no quotes). Now select &#8220;One or more times&#8221; from the &#8220;Occurs&#8221; drop down. The expression is built, it now has to be added by clicking the &#8220;Add&#8221; button.</p><p>This is where the behavior gets a bit odd. After you push the Add button you have to put the OK button to add the expression to the main search window. The problem is, by pushing the OK button your default web browser will open to the SearchMonkey web page. This has nothing to do with your searching. You can close your web browser (or the tab SearcMonkey opened) without any effect to SearchMonkey. After the web page opens, go back to the SearchMonkey window and click Cancel which will take you back to the main window. Now you should see, the &#8220;Containing&#8221; section the string &#8220;(Figure)+&#8221; (no quotes). That is the expression to find all files that contain the string &#8220;Figure&#8221; (no quotes).</p><p>Click Start and you will quickly see the results pile up (given your file system contains files that match the expression.) Depending upon the size of your hard drive, the amount of files/folders on your machine, the complexity of your regular expression, and the speed of your machine the search could take some time.</p><p><strong>Final thoughts</strong></p><p>That gives you an idea how SearchMonkey is used. If you&#8217;re looking for a search tool that gives you far more power at your fingertips than the standard fair, SearchMonkey might be the perfect solution for you. Not only can you search your entire file system, you can create some fairly complex regular expressions to add power to your searching.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/09/30/power-searching-linux-with-searchmonkey/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Customize your replies with Claws Mail Templates</title><link>http://www.ghacks.net/2009/07/19/customize-your-replies-with-claws-mail-templates/</link> <comments>http://www.ghacks.net/2009/07/19/customize-your-replies-with-claws-mail-templates/#comments</comments> <pubDate>Sun, 19 Jul 2009 14:37:16 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Email]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Software]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[bottom posting]]></category> <category><![CDATA[claws mail]]></category> <category><![CDATA[regular expressions]]></category> <category><![CDATA[reply templates]]></category> <category><![CDATA[tags]]></category> <category><![CDATA[top posting]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=14528</guid> <description><![CDATA[Lately I have been on a roll with Claws mail (see &#8220;Claws Mail: The unsung powerhouse email client&#8220;, &#8220;Claws Mail must have plugins&#8220;, &#8220;Create Message Filters in Claws Mail&#8220;, and &#8220;Encrypting email in Claws Mail&#8220;.) The reason for that? It&#8217;s an outstanding email client that is powerful, fast, and very flexible. In fact I would [...]]]></description> <content:encoded><![CDATA[<p>Lately I have been on a roll with Claws mail (see &#8220;<a
title="Claws Mail" href="http://www.ghacks.net/2009/07/04/claws-mail-the-unsung-powerhouse-email-client/" target="_blank">Claws Mail: The unsung powerhouse email client</a>&#8220;, &#8220;<a
title="Claws Mail plugins" href="http://www.ghacks.net/2009/07/04/claws-mail-must-have-plugins/" target="_blank">Claws Mail must have plugins</a>&#8220;, &#8220;<a
title="Claws Mail filters" href="http://www.ghacks.net/2009/07/10/create-message-filters-in-claws-mail/" target="_blank">Create Message Filters in Claws Mail</a>&#8220;, and &#8220;<a
title="Claws Mail encryption" href="http://www.ghacks.net/2009/07/11/encrypting-email-in-claws-mail/" target="_blank">Encrypting email in Claws Mail</a>&#8220;.) The reason for that? It&#8217;s an outstanding email client that is powerful, fast, and very flexible. In fact I would argue that Claws Mail is one of the most flexible email clients available. To illustrate that I want to introduce you to a feature that I find a &#8220;must use&#8221; for my email needs. That feature? Templates.</p><p>The Claws Mail template feature allows you to create specific templates that format your email in precisely the way you want them. Your compositions, your replies, and your forwards can leave your PC laid out exactly the way you want them. And it doesn&#8217;t take a programmer or guru to set templates up. You just have to understand the strings used by Claws Mail that allow you to insert specific, pre-configured fields into the body of your email.</p><p><span
id="more-14528"></span></p><div
id="attachment_14535" class="wp-caption alignleft" style="width: 310px"><a
rel="attachment wp-att-14535" href="http://www.ghacks.net/2009/07/19/customize-your-replies-with-claws-mail-templates/templates-2/"><img
class="size-medium wp-image-14535" src="http://www.ghacks.net/wp-content/uploads/2009/07/templates1-500x402.png" alt="Figure 1" width="300" height="241" /></a><p
class="wp-caption-text">Figure 1</p></div><p>You can create templates within one of two windows: &#8220;Preferences for current account&#8221; or &#8220;Preferences&#8221; (the former only configures templates for the account being used and the latter configures templates globally). Both of these windows can be opened from within the Configuration menu. Once in either of these windows go to the Templates section where you will find  three tabs (see Figure 1): Compose, Reply, and Forward. The first thing you must do is decide what type of template you want to create. Most often people use the Reply template so they can format how they want their replies to look.</p><p>As you can see, in Figure 1, I have already created a template. The template I have created does this when I reply to an email:</p><p>The first line of the reply reads <em>In a recent email ORIGINAL_SENDER said the following:</em></p><p><em>QUOTED_EMAIL</em></p><p><em>to this REPLY_SENDER says:</em></p><p><em>BODY_OF_REPLY</em></p><p><em>A: Because it makes understanding the conversation harder?<br
/> Q: What is wrong with top posting?</em></p><ul><li>Where ORIGINAL_SENDER is who the email came from.</li><li>Where QUOTED_EMAIL is the quoted text of the email you are replying to.</li><li>Where REPLY_SENDER is the full name of the user replying.</li><li>Where BODY_OF_REPLY is the text written in the reply.</li></ul><p>You will also notice a bit of snarkiness at the end. ;-)</p><p>To achieve this layout I used the following pre-defined tags:</p><ul><li>%N &#8211; Original sender.</li><li>\n &#8211; New line marker.</li><li>%Q &#8211; Quoted message body.</li><li>%af &#8211; Full name of sender (me).</li><li>%X &#8211; Cursor position.</li></ul><p>The %X tag is one of the most interesting of the tags. It is with this tag you define where you want your cursor to be placed when you begin the email. Because Claws Mail defaults to bottom posting, and has no means to change this to top posting, you have to define top posting by using the %X tag. So if I want to always top post in my replies I would create a reply template like this:</p><p><code>%X\n<br
/> Is my reply to an email sent by %N, that said:\n<br
/> %Q</code></p><p>To get a full list of all the possible tags to use click the Information button inside of the Templates configuration window. You will also notice you can use regular expressions in your templates. The possibilites abound!</p><p><strong>Final thoughts</strong></p><p>Once you start using templates in Claws Mail you will really begin to see how flexible this application is. Once I started using templates I never looked back to Thunderbird. Have you created a cool template for Claws Mail? If so, share it with your fellow Ghacks readers.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/07/19/customize-your-replies-with-claws-mail-templates/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> </channel> </rss>
