<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Grep</id>
	<title>Grep - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://dikapediav2.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Grep"/>
	<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=Grep&amp;action=history"/>
	<updated>2026-04-25T04:53:50Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://dikapediav2.com/wiki/index.php?title=Grep&amp;diff=254&amp;oldid=prev</id>
		<title>Ardika Sulistija at 13:57, 4 October 2024</title>
		<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=Grep&amp;diff=254&amp;oldid=prev"/>
		<updated>2024-10-04T13:57:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:57, 4 October 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l47&quot;&gt;Line 47:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 47:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  grep -o &amp;#039;needle&amp;#039; file | wc -l&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  grep -o &amp;#039;needle&amp;#039; file | wc -l&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;====Search for a string and show the following lines before/after it====&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;----&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;you can use -B num to set how many lines before the match and -A num for the number of lines after the match.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; grep -B 3 -A 2 foo README.txt&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ardika Sulistija</name></author>
	</entry>
	<entry>
		<id>https://dikapediav2.com/wiki/index.php?title=Grep&amp;diff=88&amp;oldid=prev</id>
		<title>Ardika Sulistija: Created page with &quot;&lt;B&gt;grep&lt;/B&gt; - Pretty much a search function. Prints lines matching a pattern.  -----   Examples:  cat [file] | grep &quot;word&quot;         # Prints any line with &quot;word&quot;    grep -i                          # Ignore case senisitivity *i is for INSENSITIVE*    grep -irl [word] [dir]                  # Ignore case distinctions,  Read all files under each directory, recursively, Suppress normal output;     grep [word] [in file/dir]        # Searches up &quot;word&quot; in that file or dir    g...&quot;</title>
		<link rel="alternate" type="text/html" href="https://dikapediav2.com/wiki/index.php?title=Grep&amp;diff=88&amp;oldid=prev"/>
		<updated>2024-08-27T00:19:46Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;B&amp;gt;grep&amp;lt;/B&amp;gt; - Pretty much a search function. Prints lines matching a pattern.  -----   Examples:  cat [file] | grep &amp;quot;word&amp;quot;         # Prints any line with &amp;quot;word&amp;quot;    grep -i                          # Ignore case senisitivity *i is for INSENSITIVE*    grep -irl [word] [dir]                  # Ignore case distinctions,  Read all files under each directory, recursively, Suppress normal output;     grep [word] [in file/dir]        # Searches up &amp;quot;word&amp;quot; in that file or dir    g...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;B&amp;gt;grep&amp;lt;/B&amp;gt; - Pretty much a search function. Prints lines matching a pattern.&lt;br /&gt;
&lt;br /&gt;
-----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Examples:&lt;br /&gt;
 cat [file] | grep &amp;quot;word&amp;quot;         # Prints any line with &amp;quot;word&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 grep -i                          # Ignore case senisitivity *i is for INSENSITIVE*&lt;br /&gt;
 &lt;br /&gt;
 grep -irl [word] [dir]                  # Ignore case distinctions,  Read all files under each directory, recursively, Suppress normal output; &lt;br /&gt;
 &lt;br /&gt;
 grep [word] [in file/dir]        # Searches up &amp;quot;word&amp;quot; in that file or dir&lt;br /&gt;
 &lt;br /&gt;
 grep [x$] [file]                 # Searches the file with any word that ENDS &amp;quot;x&amp;quot; in it. Variation: [xxx$] &lt;br /&gt;
 multiple letter search that ends with these letters.&lt;br /&gt;
 &lt;br /&gt;
 grep [^x]                        # Searches the file with any word that STARTS with &amp;quot;x&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 grep [^x$]                       # Searches lines that ONLY has &amp;#039;x&amp;#039; in it.&lt;br /&gt;
 &lt;br /&gt;
 grep &amp;quot;x.*&amp;quot; [file]                # Searches up a letter, doesn&amp;#039;t matter if it is in the beginnging or end of the line.&lt;br /&gt;
 &lt;br /&gt;
 grep -i &amp;quot;^l.*rse$&amp;quot; [file]        # Searches file for anything starts with &amp;quot;l&amp;quot;, anything in the middle, and ends in &amp;quot;rse&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 grep -i &amp;#039;[ab]&amp;#039; [file]            # Searches all lines that have a &amp;#039;a&amp;#039; or &amp;#039;b&amp;#039; in it.&lt;br /&gt;
 &lt;br /&gt;
 grep [Xx]avier                   # Searches lines that contain [X]avier or [x]avier&lt;br /&gt;
 &lt;br /&gt;
 grep [wrd] [file] | grep &amp;quot;word&amp;quot;  grepception.&lt;br /&gt;
 &lt;br /&gt;
 grep -v &amp;#039;^x&amp;#039; [file]              # &amp;#039;-v&amp;#039; means inverse, so this means, search all lines that DO NOT start with &amp;#039;x&amp;#039;&lt;br /&gt;
 &lt;br /&gt;
 grep &amp;#039;[^brackets]&amp;#039;               # Search all lines with anything THAT IS NOT IN THE BRACKETS&lt;br /&gt;
 &lt;br /&gt;
 grep --color=always              # use color to highlight&lt;br /&gt;
&lt;br /&gt;
====Search for two words at once====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
 grep -E &amp;#039;word1|word2&amp;#039; *.doc&lt;br /&gt;
&lt;br /&gt;
====Count the number of occurrences====&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
grep&amp;#039;s -o will only output the matches, ignoring lines; wc can count them:&lt;br /&gt;
&lt;br /&gt;
 grep -o &amp;#039;needle&amp;#039; file | wc -l&lt;/div&gt;</summary>
		<author><name>Ardika Sulistija</name></author>
	</entry>
</feed>