<?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>Grep command line options Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/grep-command-line-options/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/grep-command-line-options/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:53:56 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Unix Command: Grep &#8211; Quick Reference &#8211; Pattern &#8211; Examples &#8211; Options</title>
		<link>https://www.scmgalaxy.com/tutorials/unix-command-grep/</link>
					<comments>https://www.scmgalaxy.com/tutorials/unix-command-grep/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 16 Apr 2010 08:52:59 +0000</pubDate>
				<category><![CDATA[Unix - Linux]]></category>
		<category><![CDATA[Basic grep commands]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[Grep]]></category>
		<category><![CDATA[Grep command line options]]></category>
		<category><![CDATA[Grep Unix Command Guide]]></category>
		<category><![CDATA[Grep Unix Command Introduction]]></category>
		<category><![CDATA[Grep Unix Command Overview]]></category>
		<category><![CDATA[Grep Unix Command Quick reference]]></category>
		<category><![CDATA[Grep Unix Commands With Examples]]></category>
		<category><![CDATA[How to Use Grep]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[Unix command grep examples]]></category>
		<category><![CDATA[Unix grep command match pattern]]></category>
		<category><![CDATA[Unix Grep Command Options]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2010/04/16/unix-command-grep/</guid>

					<description><![CDATA[<p>Grep scans its input for a pattern, and can display the selected pattern, the line numbers of the filenames where [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/unix-command-grep/">Unix Command: Grep &#8211; Quick Reference &#8211; Pattern &#8211; Examples &#8211; Options</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4369" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/04/unix-command-grep.png" alt="unix-command-grep" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/04/unix-command-grep.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2010/04/unix-command-grep-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><b>Grep </b>scans its input for a pattern, and can display the selected pattern, the line numbers of the filenames where the pattern occurs, The command uses the following syntax<br />
<i></i></span></span></p>
<p><span style="font-size: small;"><u><span style="font-family: verdana,geneva;"><i>grep options pattern filesname(s)</i></span></u><span style="font-family: verdana,geneva;"><br />
</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;">grep searches for pattern in one or more filenames.<br />
</span></span></p>
<p><b><span style="font-size: small;"><span style="font-family: verdana,geneva;">Example for <u>Grep</u> command: </span></span></b></p>
<ol>
<li><span style="font-size: small;"><span style="font-family: verdana,geneva;">grep “sales” emp.lst</span></span></li>
<li><span style="font-size: small;"><span style="font-family: verdana,geneva;">grep “director” emp1.lst emp2.lst</span></span></li>
<li><span style="font-size: small;"><span style="font-family: verdana,geneva;">grep ‘jai sharma’ emp.lst</span></span></li>
<li><span style="font-size: small;"><span style="font-family: verdana,geneva;">grep “jai Sharma $var” emp.lst</span></span></li>
</ol>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><b>&#8212;&#8212;&#8212;&#8212;&#8212;-Grep options&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</b></span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><b>Ignoring Case (i)</b> When you look for a name, but you are not sure of the case, grep offers the –i (ignore) option which ignores case for patteen matching.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;">&gt; Grep –i ‘agarwal’ emp.lst</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><b>Deleting Lines  or Inverse(-v):</b> -v (inverse) option selects all except lines containing the pattern. Thus, you can create a file other list containing all but director.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;">&gt; Grep –v “director” emp.lst &gt; other list</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><b>Displaying line Numbers (-n): </b>The –n(number) options displays the line numbers containing the pattern, along with the lines:</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;">&gt; grep –n ‘marketing’ emp.lst</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><b>Counting Line Containing patterns (-c):</b> The –c (count) option counts the number of lines containing the pattern ( which is not the same as number of occurrences).</span></span></p>
<ol>
<li><span style="font-size: small;"><span style="font-family: verdana,geneva;">grep –c director emp.lst</span></span></li>
<li><span style="font-size: small;"><span style="font-family: verdana,geneva;">grep –c director emp*.lst</span></span></li>
</ol>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><b>Displaying Filenames (-l):</b> The –l (list) option displays only the files names of files containing the pattern.</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;">&gt; grep –l ‘manager’ *.lst</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><b>Matching Multiple Patterns(-e):</b> With the –e option, you can match the three agarwals by using grep like this:</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;">&gt; grep –e “Agarwal” –e “aggarwal” –e “agarwal” emp.lst</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"><b>Taking patterns from a file (-f):</b> we can place all patterns in a separate file, one pattern per lin. Grep takes inputs from there with the –f option:</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;">&gt; grep –f pattern.lst emp.lst</span></span></p>
<p><span style="font-size: small;"><span style="font-family: verdana,geneva;"> </span></span></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/unix-command-grep/">Unix Command: Grep &#8211; Quick Reference &#8211; Pattern &#8211; Examples &#8211; Options</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/unix-command-grep/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
