<?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; grep</title> <atom:link href="http://www.ghacks.net/tag/grep/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 09:52:46 +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>GGrep, Windows Text Search, Replace Software</title><link>http://www.ghacks.net/2011/09/30/ggrep-windows-text-search-replace-software/</link> <comments>http://www.ghacks.net/2011/09/30/ggrep-windows-text-search-replace-software/#comments</comments> <pubDate>Fri, 30 Sep 2011 18:43:27 +0000</pubDate> <dc:creator>Martin Brinkmann</dc:creator> <category><![CDATA[Software]]></category> <category><![CDATA[Windows]]></category> <category><![CDATA[ggrep]]></category> <category><![CDATA[grep]]></category> <category><![CDATA[portable software]]></category> <category><![CDATA[replace]]></category> <category><![CDATA[search]]></category> <category><![CDATA[windows software]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=50987</guid> <description><![CDATA[GGrep is a text search and replace software for the Windows operating system that is based on the original Grep tool of Unix based machines. The portable Windows software comes with a user interface that displays the majority of features right on the start screen. A basic search requires a search term and the selection [...]]]></description> <content:encoded><![CDATA[<p>GGrep is a text search and replace software for the Windows operating system that is based on the original Grep tool of Unix based machines. The portable Windows software comes with a user interface that displays the majority of features right on the start screen. A basic search requires a search term and the selection of a root folder on a connected hard drive. A click on Search parses all files and displays all files containing the search term in the results listing.</p><p>The files are displayed with their name, the row and column the phrase was found and the phrase surrounded by words before and after. One of the issues that I found was that it was not possible to scroll horizontally. The only option to display all text was to increase the window size significantly.</p><p>Filters are available to narrow down the search results. It is for instance possible to search only specific file types or folders, or to exclude files and folders from the search.</p><p><img
src="http://www.ghacks.net/wp-content/uploads/2011/09/ggrep.png" alt="ggrep" title="ggrep" width="539" height="528" class="alignnone size-full wp-image-50988" /></p><p>Other filters include making the search case sensitive or to limit the results to full word matches. GGrep supports regular expressions just like the original grep application. This opens up several interesting options for more powerful search and replace operations. You could for instance search for euro|dollar to find documents containing either the phrase euro or dollar.</p><p>Another interesting feature of GGrep is the option to replace text. While it is possible to use simple text to text replacements, one could use regular expressions for better text matching.</p><p>Please note that the program is not displaying a list of possible matches first. When you click Replace the replacing of text happens instantly and without option to undo the changes (other than reversing search and replace strings).</p><p>The results of a search or replace can be exported into a csv file which can then be imported into programs like Excel. Windows users who are looking for a powerful search and replace tool should take a closer look at <a
href="http://code.google.com/p/ggrep/">GGrep</a>. The software is compatible with all recent 32-bit and 64-bit editions of the operating system.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2011/09/30/ggrep-windows-text-search-replace-software/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <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>Linux Tips: Handy ways to grep</title><link>http://www.ghacks.net/2009/07/09/linux-tips-handy-ways-to-grep/</link> <comments>http://www.ghacks.net/2009/07/09/linux-tips-handy-ways-to-grep/#comments</comments> <pubDate>Wed, 08 Jul 2009 22:11:29 +0000</pubDate> <dc:creator>Jack Wallen</dc:creator> <category><![CDATA[Advice]]></category> <category><![CDATA[Linux]]></category> <category><![CDATA[Open Source]]></category> <category><![CDATA[Tutorials Basic]]></category> <category><![CDATA[command-line]]></category> <category><![CDATA[grep]]></category> <category><![CDATA[linux command line]]></category> <guid
isPermaLink="false">http://www.ghacks.net/?p=14085</guid> <description><![CDATA[The grep command is one of the handiest Linux commands you will use. The grep utitility was originally writing for UNIX and stands for Global Regular Expression Print. What grep does is search for strings in practically anything you need to search. You can search nearly any type of file, output, logs&#8230;you name it, grep [...]]]></description> <content:encoded><![CDATA[<p>The grep command is one of the handiest Linux commands you will use. The grep utitility was originally writing for UNIX and stands for Global Regular Expression Print. What grep does is search for strings in practically anything you need to search. You can search nearly any type of file, output, logs&#8230;you name it, grep can search it.</p><p>But because grep is so handy, it&#8217;s hard to know where to start. Of course you can use grep in the standard way, but when you can do so much with a command, why not learn some cool tricks. And that&#8217;s what we&#8217;ll do here &#8211; learn how to use grep to really make it useful.</p><p><span
id="more-14085"></span><strong>Basic usage</strong></p><p>Before we get into some fun stuff, we should look at the basic command structure. To use <em>grep</em> in its most basic form you follow this structure:</p><p>grep STRING FILE</p><p>Where STRING is the string of characters you want to search for and FILE is the file you want to search.</p><p>Say, for instance, I want to search the file <strong>test.txt </strong>for the string &#8220;Linux&#8221; (no quotes). I can do this with the command:</p><p><em>grep Linux test.txt</em></p><p>What grep will do is print out (at the prompt) every line in the file that contains the word Linux. But what if you are searching a large configuration file and you need to find the location of a specific option. To do this you can add the &#8220;n&#8221; switch which will print out the line numbers associated with each line. Let&#8217;s look at a different example. Say you need to find out what port Dansguardian listens to. Instead of scrolling through every line of the <strong>/etc/dansguardian/dansguardian.conf</strong> file for the string &#8220;port&#8221; (no quotes), you could issue the command:</p><p>grep -n port /etc/dansguardian/dansguardian.conf</p><p>which would report back something like:</p><p><code>6:# Web Access Denied Reporting (does not affect logging)<br
/> 10:#  1 = report why but not what denied phrase<br
/> 11:#  2 = report fully<br
/> 14:reportinglevel = 3<br
/> 17:# The HTML template within this dir is only used when reportinglevel<br
/> 87:# the port that DansGuardian listens to.<br
/> 88:filterport = 8080<br
/> 93:# the port DansGuardian connects to proxy on<br
/> 94:proxyport = 3128<br
/> 97:# dansguardian reporting script was copied. Only used in reporting levels 1 and 2.<br
/> 153:# the naughtyness limit will be log</code></p><p>So you can see that line 88 is the filter port and 94 is the proxy port. Easy. Now let&#8217;s see what else grep can do.</p><p><strong>Lines before and after</strong></p><p>What if you not only want to see the single line associated with a string, but also a certain amount of lines above and below that line. You can do this using the -A and -B switches like so (we&#8217;ll stick with our dansguardian example):</p><p><em>grep -B1 -A2 -n port dansguardian.conf</em></p><p>The above command would print out not only each line containing the string &#8220;port&#8221; (no quotes) but also the 1 line above it and the next two lines below it.</p><p><strong>Pipe other commands</strong></p><p>You remember the <em>dmesg </em>command. This command prints out the kernel buffer &#8211; it&#8217;s where you learn a lot about your machine. What if you want to check out CPU information in the <em>dmesg </em>output. You can issue the command <em>dmesg | less</em> and scroll around until you find it, or you can issue the command:</p><p><em>dmesg | grep -n CPU</em></p><p>which will print out all the dmesg output that contains the string CPU and the lines numbers associated with each line.</p><p><strong>Search directories</strong></p><p>You can also have <em>grep </em>help you in your search of directories. To do this you would use it in conjunction with, say, the <em>find </em>command. Say you were looking for the configuration file for the nano text editor but you had no idea what it was called or where it was located. You could pipe the output of the <em>find</em> command to <em>grep </em>(as the root or sudo user) like so:</p><p><em>find / | grep nano | less </em></p><p>and you would see among the output:</p><p>/etc/nanorc<br
/> Bingo! There&#8217;s your configuration file.</p><p><strong>Final thoughts</strong></p><p>As you can see there are a number of ways that the <em>grep</em> command can be of assistance. And this is only scratching the surface. Do you have a nifty way to use <em>grep</em>? If so, share it with your fellow ghacks members.</p> ]]></content:encoded> <wfw:commentRss>http://www.ghacks.net/2009/07/09/linux-tips-handy-ways-to-grep/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss>
