<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: How to Filter Text or String Using Awk and Regular Expressions &#8211; Part 1	</title>
	<atom:link href="https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/</link>
	<description>Tecmint - Linux Howtos, Tutorials, Guides, News, Tips and Tricks.</description>
	<lastBuildDate>Mon, 12 Aug 2024 06:43:01 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Pooja		</title>
		<link>https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/comment-page-1/#comment-2161747</link>

		<dc:creator><![CDATA[Pooja]]></dc:creator>
		<pubDate>Tue, 23 Apr 2024 08:59:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=19807#comment-2161747</guid>

					<description><![CDATA[I&#039;ve come across many awk tutorials, but this one stands out as the best by far. It&#039;s helped me grasp awk in a way I never thought possible. The breakdown of the awk syntax, particularly the explanation of &quot;awk pattern action file,&quot; is incredibly clear and concise. I&#039;ve yet to find such clarity elsewhere. Thank you immensely for this invaluable resource.]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve come across many awk tutorials, but this one stands out as the best by far. It&#8217;s helped me grasp awk in a way I never thought possible. The breakdown of the awk syntax, particularly the explanation of &#8220;awk pattern action file,&#8221; is incredibly clear and concise. I&#8217;ve yet to find such clarity elsewhere. Thank you immensely for this invaluable resource.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: aparna bl		</title>
		<link>https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/comment-page-1/#comment-1472126</link>

		<dc:creator><![CDATA[aparna bl]]></dc:creator>
		<pubDate>Wed, 07 Apr 2021 13:46:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=19807#comment-1472126</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/comment-page-1/#comment-828999&quot;&gt;Erik Persson&lt;/a&gt;.

HI Erik Persson

You are awesome. You taught me awk. No one else explained it like you. Do you teach?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/comment-page-1/#comment-828999">Erik Persson</a>.</p>
<p>HI Erik Persson</p>
<p>You are awesome. You taught me awk. No one else explained it like you. Do you teach?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: RF Engineer		</title>
		<link>https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/comment-page-1/#comment-1466138</link>

		<dc:creator><![CDATA[RF Engineer]]></dc:creator>
		<pubDate>Wed, 31 Mar 2021 07:05:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=19807#comment-1466138</guid>

					<description><![CDATA[This is wonderful tutorial and very well illustrated.

There is a minor error in the explanations on what asterisk &lt;code&gt;(*)&lt;/code&gt; means in regular expressions -- it means &#039;&lt;strong&gt;match the previous character zero or more times&lt;/strong&gt;&#039;. For example &lt;code&gt;&#039;p*&#039;&lt;/code&gt; will match the letter &lt;strong&gt;&#039;p&#039;&lt;/strong&gt; zero or more times, thus this expression will match anything and everything because it will be looking for the letter &lt;strong&gt;&#039;p&#039;&lt;/strong&gt; to be contained zero or more times -- and absolutely any text contains the letter &lt;strong&gt;&#039;p&#039;&lt;/strong&gt; either zero or more times. 

For this reason asterisk is never used with just a single symbol before it, it must be used in an expression with more symbols inside it, like &lt;code&gt;/A-*B/&lt;/code&gt;, which will match &lt;strong&gt;&quot;A&quot;&lt;/strong&gt; followed by zero or more hyphens &lt;code&gt;&quot;-&quot;&lt;/code&gt; and then followed by &lt;strong&gt;&quot;B&quot;&lt;/strong&gt;, thus the following strings will produce a match &lt;strong&gt;&quot;AB&quot;&lt;/strong&gt; (this has zero occurrences of &lt;strong&gt;&#039;-&#039;&lt;/strong&gt;), &lt;strong&gt;&quot;A-B&quot;&lt;/strong&gt;, &lt;strong&gt;&quot;A--B&quot;,&lt;/strong&gt; &lt;strong&gt;&quot;A---B&quot;&lt;/strong&gt; and so on. 

Note that the text presented in this tutorial erroneously suggests that &lt;code&gt;/A-*B/&lt;/code&gt; will not match &lt;strong&gt;&quot;AB&quot;&lt;/strong&gt; when a simple check in &lt;strong&gt;AWK&lt;/strong&gt; shows that it is matching it (in fact a test in any &lt;strong&gt;REGEXP&lt;/strong&gt; application will show the same result, e.g. egrep).

For this reason this tutorial interprets somewhat erroneously the result of:
&lt;pre&gt;
# awk &#039;/l*c/{print}&#039; /etc/localhost
&lt;/pre&gt;
The above will match all lines that contain the letter &lt;strong&gt;&#039;c&#039;&lt;/strong&gt; regardless whether they contain the letter &lt;strong&gt;&#039;l&#039;&lt;/strong&gt; or not. This is because &lt;code&gt;/l*/&lt;/code&gt; means &#039;&lt;strong&gt;match letter l zero or more times&lt;/strong&gt;&#039;, so &lt;code&gt;/l*c/&lt;/code&gt; means &#039;&lt;strong&gt;match letter c preceded by zero or more occurrences of letter l&lt;/strong&gt;&#039;, but any line that contains the letter &lt;strong&gt;c&lt;/strong&gt; in it also contain zero or more letters &lt;strong&gt;l&lt;/strong&gt; in front of it -- the key to understanding this is &quot;&lt;strong&gt;ZERO or more times&lt;/strong&gt;&quot;.

&lt;strong&gt;CONCLUSION&lt;/strong&gt;: In &lt;strong&gt;REGEXP&lt;/strong&gt; the asterisk symbol &lt;code&gt;(*)&lt;/code&gt; does not mean the same thing as in Microsoft Windows and DOS/CMD file-name matching, it does not match any character (as this tutorial erroneously suggests), it matches the preceding character ZERO or more times.]]></description>
			<content:encoded><![CDATA[<p>This is wonderful tutorial and very well illustrated.</p>
<p>There is a minor error in the explanations on what asterisk <code>(*)</code> means in regular expressions &#8212; it means &#8216;<strong>match the previous character zero or more times</strong>&#8216;. For example <code>'p*'</code> will match the letter <strong>&#8216;p&#8217;</strong> zero or more times, thus this expression will match anything and everything because it will be looking for the letter <strong>&#8216;p&#8217;</strong> to be contained zero or more times &#8212; and absolutely any text contains the letter <strong>&#8216;p&#8217;</strong> either zero or more times. </p>
<p>For this reason asterisk is never used with just a single symbol before it, it must be used in an expression with more symbols inside it, like <code>/A-*B/</code>, which will match <strong>&#8220;A&#8221;</strong> followed by zero or more hyphens <code>"-"</code> and then followed by <strong>&#8220;B&#8221;</strong>, thus the following strings will produce a match <strong>&#8220;AB&#8221;</strong> (this has zero occurrences of <strong>&#8216;-&#8216;</strong>), <strong>&#8220;A-B&#8221;</strong>, <strong>&#8220;A&#8211;B&#8221;,</strong> <strong>&#8220;A&#8212;B&#8221;</strong> and so on. </p>
<p>Note that the text presented in this tutorial erroneously suggests that <code>/A-*B/</code> will not match <strong>&#8220;AB&#8221;</strong> when a simple check in <strong>AWK</strong> shows that it is matching it (in fact a test in any <strong>REGEXP</strong> application will show the same result, e.g. egrep).</p>
<p>For this reason this tutorial interprets somewhat erroneously the result of:</p>
<pre>
# awk '/l*c/{print}' /etc/localhost
</pre>
<p>The above will match all lines that contain the letter <strong>&#8216;c&#8217;</strong> regardless whether they contain the letter <strong>&#8216;l&#8217;</strong> or not. This is because <code>/l*/</code> means &#8216;<strong>match letter l zero or more times</strong>&#8216;, so <code>/l*c/</code> means &#8216;<strong>match letter c preceded by zero or more occurrences of letter l</strong>&#8216;, but any line that contains the letter <strong>c</strong> in it also contain zero or more letters <strong>l</strong> in front of it &#8212; the key to understanding this is &#8220;<strong>ZERO or more times</strong>&#8220;.</p>
<p><strong>CONCLUSION</strong>: In <strong>REGEXP</strong> the asterisk symbol <code>(*)</code> does not mean the same thing as in Microsoft Windows and DOS/CMD file-name matching, it does not match any character (as this tutorial erroneously suggests), it matches the preceding character ZERO or more times.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Daniel P Fruzzetti		</title>
		<link>https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/comment-page-1/#comment-1166290</link>

		<dc:creator><![CDATA[Daniel P Fruzzetti]]></dc:creator>
		<pubDate>Tue, 11 Jun 2019 19:42:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=19807#comment-1166290</guid>

					<description><![CDATA[I&#039;m struggling to make my script work. I have a huge file and each line needs to be searched for the string &quot;&lt;strong&gt;WAP&quot;&lt;/strong&gt; and then, when found, the character appearing two characters &lt;strong&gt;BEFORE&lt;/strong&gt; the string needs to be returned.  Can you help me simplify this?]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m struggling to make my script work. I have a huge file and each line needs to be searched for the string &#8220;<strong>WAP&#8221;</strong> and then, when found, the character appearing two characters <strong>BEFORE</strong> the string needs to be returned.  Can you help me simplify this?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: mithran		</title>
		<link>https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/comment-page-1/#comment-1058324</link>

		<dc:creator><![CDATA[mithran]]></dc:creator>
		<pubDate>Mon, 12 Nov 2018 10:04:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.tecmint.com/?p=19807#comment-1058324</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/comment-page-1/#comment-1038353&quot;&gt;Erick Manuel Bazán&lt;/a&gt;.

HI,

Can you please provide the script details further, if possible

Thanks &#038; Regards,
Mithran]]></description>
			<content:encoded><![CDATA[<p>In reply to <a target="_blank" href="https://www.tecmint.com/use-linux-awk-command-to-filter-text-string-in-files/comment-page-1/#comment-1038353">Erick Manuel Bazán</a>.</p>
<p>HI,</p>
<p>Can you please provide the script details further, if possible</p>
<p>Thanks &amp; Regards,<br />
Mithran</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
