<?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 Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/grep/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/grep/</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>Grep and Sed Questions with Shell script</title>
		<link>https://www.scmgalaxy.com/tutorials/grep-and-sed-questions-with-shell-script/</link>
					<comments>https://www.scmgalaxy.com/tutorials/grep-and-sed-questions-with-shell-script/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 07:25:03 +0000</pubDate>
				<category><![CDATA[Shell Script]]></category>
		<category><![CDATA[Grep]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2323</guid>

					<description><![CDATA[<p>scmuser created the topic: grep and sed questions with shell script Search for a pattern with grep and sed and [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/grep-and-sed-questions-with-shell-script/">Grep and Sed Questions with Shell script</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: grep and sed questions with shell script</strong><br />
Search for a pattern with grep and sed and look for a file with find. Test the return value of each command when it displays no output. What conclusions would you draw?</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/grep-and-sed-questions-with-shell-script/">Grep and Sed Questions with Shell script</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/grep-and-sed-questions-with-shell-script/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Remove blank line using Grep and sed</title>
		<link>https://www.scmgalaxy.com/tutorials/remove-blank-line-using-grep-and-sed/</link>
					<comments>https://www.scmgalaxy.com/tutorials/remove-blank-line-using-grep-and-sed/#respond</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Fri, 08 Dec 2017 06:38:55 +0000</pubDate>
				<category><![CDATA[Shell Script]]></category>
		<category><![CDATA[Grep]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/?p=2292</guid>

					<description><![CDATA[<p>scmuser created the topic: Remove blank line using Grep and sed Hi, How do you remove blank line using grep [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/remove-blank-line-using-grep-and-sed/">Remove blank line using Grep and sed</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>scmuser created the topic: Remove blank line using Grep and sed</strong><br />
Hi,</p>
<p>How do you remove blank line using grep and sed in shell scripting?</p>
<p><strong>rajeshkumar replied the topic: Re: Remove blank line using Grep and sed</strong></p>
<p><code>grep -v "^$" filename > newfilename</code></p>
<p>The ^$ within the quotes is a regular expression: ^=beginning of line, $=end of line, with no characters between.</p>
<p>To store output to another file use redirection operator:</p>
<p>$ sed &#8216;/^$/d&#8217; /tmp/data.txt > /tmp/output.txt</p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p><strong>rajeshkumar replied the topic: Re: Remove blank line using Grep and sed</strong><br />
The above script will work only if you have no character in the blank line but most of the time it can happen that Tab can be possle in blank line&#8230;.</p>
<p>so for this situation u should try following..</p>
<p><code>sed '/^[PRESS TAB]*$/d' filename</code></p>
<p>Regards,<br />
Rajesh Kumar<br />
Twitt me @ <a href="http://twitter.com/RajeshKumarIn">twitter.com/RajeshKumarIn</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/remove-blank-line-using-grep-and-sed/">Remove blank line using Grep and sed</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/remove-blank-line-using-grep-and-sed/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<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>
