{"id":1785,"date":"2022-02-24T21:15:00","date_gmt":"2022-02-24T15:45:00","guid":{"rendered":"https:\/\/smarttech101.com\/?p=1785"},"modified":"2022-11-12T02:08:51","modified_gmt":"2022-11-11T20:38:51","slug":"grep-command-in-linux","status":"publish","type":"post","link":"https:\/\/smarttech101.com\/grep-command-in-linux\/","title":{"rendered":"Grep Command in Linux with Examples"},"content":{"rendered":"\n<p>Grep command in Linux is used to &#8220;grapple&#8221; any type of strings from all sorts of files. In this article, I will talk about its basic applications with examples. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Table of Contents<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"#basics-of-grep-command\">Basics of grep command in Linux<\/a><\/li><li><a href=\"#how-to-make-grep-search-case-insensitively\">How to make grep search case-insensitively<\/a><\/li><li><a href=\"#how-to-grep-multiple-patterns\">How to grep multiple patterns<\/a><\/li><li><a href=\"#how-to-grep-pattern-s-in-all-files-in-a-direcotry-recursively\">How to grep pattern(s) in all files in a directory recursively<\/a><\/li><li><a href=\"#how-to-print-the-line-number-as-well-in-grep\">How to print the line number as well in grep<\/a><\/li><li><a href=\"#how-to-get-colored-output-in-grep\">How to get colored output using grep<\/a><\/li><li><a href=\"#how-to-print-only-the-matching-part-in-grep\">How to print only the matching part in grep<\/a><\/li><li><a href=\"#how-to-grep-only-the-non-matching-lines\">How to grep only the non-matching lines<\/a><\/li><li><a href=\"#how-to-make-grep-to-output-only-the-number-of-matching-lines\">How to make grep to output only the number of matching lines<\/a><\/li><li><a href=\"#how-to-search-directly-for-a-word-using-grep\">How to search directly for a word using grep<\/a><\/li><li><a href=\"#how-to-search-directly-for-a-line-using-grep\">How to search directly for a line using grep<\/a><\/li><li><a href=\"#what-is-pattern-in-grep\">What is PATTERN in grep command in Linux<\/a><ul><li><a href=\"#extended-regular-expressions-in-grep\">Extended regular expressions in grep<\/a><\/li><li><a href=\"#basic-regular-expression-in-grep\">Basic regular expressions in grep<\/a><\/li><li><a href=\"#perl-compatible-regular-expression\">Perl-compatible regular expressions<\/a><\/li><li><a href=\"#fixed-strings-in-grep\">Fixed strings in grep<\/a><\/li><\/ul><\/li><li><a href=\"#grep_on_files_and_or_regex_starting_with_a_literal_dash\">Grep on files and\/or regex starting with a literal dash <code>-<\/code><\/a><\/li><li><a href=\"#concluding-remarks\">Concluding Remarks<\/a><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"basics-of-grep-command\">Basics of grep command in Linux<\/h2>\n\n\n\n<p>Basic Syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>grep &#91;OPTION...] PATTERNS &#91;FILE...]<\/code><\/pre>\n\n\n\n<p>In the above syntax, <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>OPTION is also called &#8220;flags&#8221;. The <code>--recursive<\/code> and <code>-r<\/code> are few of the options of the grep. The three dots <code>...<\/code> indicate that you can use more than one option.<\/li><li>Here, PATTERNS are special types of words being searched. In the example given below it is &#8220;it&#8221;.<\/li><li>FILE is the name of the file where you want to search for your PATTERN. For the following example, it is &#8220;file.txt&#8221;<\/li><\/ul>\n\n\n\n<p>For example, The following grep command prints all the lines having the pattern &#8220;it&#8221; from the file &#8220;file.txt&#8221;.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\n\n&#91;ajay@lenovo ~]$ grep \"it\" file.txt\nit is first line.\nit is third line.<\/code><\/pre>\n\n\n\n<p>If you do not provide any filename and do not use the flag <code>--recursive<\/code>, grep searches from the standard input (<code>|, and &lt;<\/code>). <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\n\n&#91;ajay@lenovo ~]$ cat file.txt | grep \"it\"\nit is first line.\nit is third line.\n\n&#91;ajay@lenovo ~]$ &lt; file.txt grep \"it\"\nit is first line.\nit is third line.\n\n&#91;ajay@lenovo ~]$ grep \"it\" &lt; file.txt\nit is first line.\nit is third line.<\/code><\/pre>\n\n\n\n<p>Similarly, the file name dash &#8220;-&#8221; means the standard input as in the following example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ free --human --total\n               total        used        free      shared  buff\/cache   available\nMem:           6.7Gi       2.0Gi       139Mi        43Mi       4.5Gi       4.3Gi\nSwap:           14Gi        89Mi        14Gi\nTotal:          21Gi       2.1Gi        14Gi\n\n&#91;ajay@lenovo ~]$  free --human --total | grep \"Total\" -\nTotal:          21Gi       2.1Gi        14Gi<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-make-grep-search-case-insensitively\">How to make grep search case-insensitively<\/h2>\n\n\n\n<p>By default, grep searches case-sensitively. This means, grep will consider &#8220;smarttech101&#8221;, for example, and &#8220;SmartTech101&#8221; two different words.<\/p>\n\n\n\n<p>To make grep ignore the case, use the flag -i or <code>--ignore-case<\/code>.<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\n\n&#91;ajay@lenovo ~]$ grep --ignore-case \"It\" file.txt\nit is first line.\nit is third line.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-grep-multiple-patterns\">How to grep multiple patterns<\/h2>\n\n\n\n<p>If you use <code>--regexp<\/code> or -e multiple times, grep will search for all patterns given.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\n\n&#91;ajay@lenovo ~]$ grep --regexp=\"first\" --regexp=\"second\" file.txt\nit is first line.\nsecond line.<\/code><\/pre>\n\n\n\n<p>Alternatively, you can put all of your patterns in a file separated by a newline character and then use that file with the flag <code>--file<\/code> or <code>-f<\/code>. Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\n\n&#91;ajay@lenovo test]$ cat pattern-file.txt\nfirst\nsecond\n\n&#91;ajay@lenovo test]$ grep --file=pattern-file.txt file.txt\nit is first line.\nsecond line.<\/code><\/pre>\n\n\n\n<p><strong>Note 1: <\/strong>You can use both the flags <code>--file<\/code> and <code>--regexp<\/code> together. In that case, grep will search for all the patterns together.<\/p>\n\n\n\n<p><strong>Note 2<\/strong>: When the flag <code>--regexp<\/code> used only once, grep behaves normally as shown below: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ grep --regexp=\"first\" file.txt\nit is first line.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-grep-pattern-s-in-all-files-in-a-direcotry-recursively\">How to grep pattern(s) in all files in a directory recursively<\/h2>\n\n\n\n<p>To search for a pattern in all the existing files in the current working directory, you need to use the flag <code>--recursive<\/code> or -r.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo test]$ ls -1\nfile2.txt\nfile.txt\n\n&#91;ajay@lenovo test]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\n\n&#91;ajay@lenovo test]$ cat file2.txt\nI means first\nII means 2nd\nIII means third\n\n&#91;ajay@lenovo test]$ grep --recursive \"first\"\nfile2.txt:I means first\nfile.txt:it is first line.<\/code><\/pre>\n\n\n\n<p><strong>\ud83d\udcd3<\/strong> <strong>Notes:<\/strong> to remove the filename, use the flag <code>--no-filename<\/code> or <code>-h<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo test]$ grep --no-filename --recursive \"first\"\nI means first\nit is first line.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-print-the-line-number-as-well-in-grep\">How to print the line number as well in grep<\/h2>\n\n\n\n<p>The flag <code>--line-number<\/code> or -n prepends each line in the output with the serial number of that line in its input file. <\/p>\n\n\n\n<p>For instance, in the following example, the lines &#8220;it is third line.&#8221; and &#8220;III means third&#8221; are found in the third line of their respective files. Therefore, &#8216;3&#8217; is being prepended in both lines of the output.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo test]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\n\n&#91;ajay@lenovo test]$ cat file2.txt\nI means first\nII means 2nd\nIII means third\n\n&#91;ajay@lenovo test]$ grep --line-number \"third\" file.txt file2.txt\nfile.txt:3:it is third line.\nfile2.txt:3:III means third<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-get-colored-output-in-grep\">How to get colored output using grep<\/h2>\n\n\n\n<p>Grep outputs in the color using the escape sequences. For this, use the flag <code>--color=WHEN<\/code>, where WHEN is<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>always<\/code> to output in color always<\/li><li><code>never<\/code> to never output in color<\/li><li><code>auto<\/code>: grep uses the escape sequences when it outputs on the terminal. When it outputs into the pipe, it does not use the sequences. <\/li><\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"942\" height=\"301\" src=\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/2022-02-18_003313.401492005.png?resize=942%2C301&#038;ssl=1\" alt=\"grep command in Linux with colored output\" class=\"wp-image-1789\" srcset=\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/2022-02-18_003313.401492005.png?w=942&amp;ssl=1 942w, https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/2022-02-18_003313.401492005.png?resize=768%2C245&amp;ssl=1 768w\" sizes=\"(max-width: 942px) 100vw, 942px\" \/><figcaption>Figure: grep with colored output<\/figcaption><\/figure>\n\n\n\n<p><strong>Note 1: <\/strong>If you mention only the flag <code>--color<\/code> and not the <code>=WHEN<\/code>, grep will assume <code>auto<\/code>. Ex &#8211;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"626\" height=\"167\" src=\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-color.png?resize=626%2C167&#038;ssl=1\" alt=\"grep printing in color by just using the --color\" class=\"wp-image-1810\"\/><figcaption>Figure: grep printing in color by just using the <code>--color<\/code><\/figcaption><\/figure>\n\n\n\n<p><strong>Note 2: <\/strong>The flag <code>--color=auto<\/code> is very handy. Hence, you can set an alias in your <strong>.bashrc<\/strong> or <strong>.zshrc<\/strong> file.<\/p>\n\n\n\n<p><strong>Fun Point \ud83d\ude03: <\/strong>This flag, when combined with <code>--line-number<\/code> and <code>--recursive<\/code> is one of the most powerful applications of grep. Suppose you want to see how you used the <strong>tee<\/strong> command in the past in your scripts. But you do not know the locations of these scripts. To know the locations, you need to execute the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo test]$ grep --line-number --color=always --recursive \"tee\" ~\/.my_scripts\/<\/code><\/pre>\n\n\n\n<p>Output:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"1669\" height=\"132\" src=\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/image-1.png?resize=1669%2C132&#038;ssl=1\" alt=\"grep command in Linux with colored output\" class=\"wp-image-1792\" srcset=\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/image-1.png?w=1669&amp;ssl=1 1669w, https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/image-1.png?resize=768%2C61&amp;ssl=1 768w, https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/image-1.png?resize=1536%2C121&amp;ssl=1 1536w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><figcaption>Figure: grep with colored output<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-print-only-the-matching-part-in-grep\">How to print only the matching part in grep<\/h2>\n\n\n\n<p>In all of the above examples, grep is printing the whole lines in which it found the pattern. To print only the matching pattern, use the flag <code>--only-matching<\/code> or <code>-o<\/code>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo test]$ echo \"smarttech101smarttech101\" | grep --only-matching \"smart\"\nsmart\nsmart<\/code><\/pre>\n\n\n\n<p>Please note that grep prints all the matching patterns on separate lines even if they were part of the same line. This is clearly visible in the above example.<\/p>\n\n\n\n<p><strong>Application: <\/strong>You can use this flag for web scrapping (i.e. get only the required text from HTML pages).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-grep-only-the-non-matching-lines\">How to grep only the non-matching lines<\/h2>\n\n\n\n<p>Using the flag <code>--invert-match<\/code> or <code>-v<\/code>, you can invert the matching i.e. grep will print out only those lines which do not have the PATTERN.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\n\n&#91;ajay@lenovo ~]$ grep --invert-match \"second\" file.txt\nit is first line.\nit is third line.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-make-grep-to-output-only-the-number-of-matching-lines\">How to make grep to output only the number of matching lines<\/h2>\n\n\n\n<p>For this, use the <code>--count<\/code> or <code>-c<\/code> flag. Now, grep will output only the number of matching lines corresponding to each file. For example &#8211;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\n\n&#91;ajay@lenovo ~]$ cat file2.txt\nI means first\n1st also means first\nII means 2nd\nIII means third\n\n&#91;ajay@lenovo ~]$ grep --count \"first\" file.txt file2.txt\nfile.txt:1\nfile2.txt:2<\/code><\/pre>\n\n\n\n<p>In the above example, the string &#8220;first&#8221; is found only once in the file.txt but twice in the file2.txt. <\/p>\n\n\n\n<p>When you use this flag <code>--count<\/code> with the flag <code>--invert-match<\/code>, grep will output the number of non-matching lines. For example &#8211;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\n\n&#91;ajay@lenovo ~]$ cat file2.txt\nI means first\n1st also means first\nII means 2nd\nIII means third\n\n&#91;ajay@lenovo ~]$ grep --invert-match --count \"first\" file.txt file2.txt\nfile.txt:2\nfile2.txt:2<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-search-directly-for-a-word-using-grep\">How to search directly for a word using grep<\/h2>\n\n\n\n<p>For this, use the flag <code>--word-regexp<\/code> or <code>-w<\/code>. For example,<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[ajay@lenovo ~]$ echo -e 'ajay jay patel\\najay\\njay patel\\najay jay\\njaya prada' | grep --word-regexp --color \"jay\"\n\najay <font color=\"#88C0D0\"><b>jay<\/b><\/font> patel\n<font color=\"#88C0D0\"><b>jay<\/b><\/font> patel\najay <font color=\"#88C0D0\"><b>jay<\/b><\/font>\n<\/pre>\n\n\n\n<p>Here, in the above example, <\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>If &#8220;jay&#8221; comes at the start of the line, it should be followed by the non-word characters (<code>\\W<\/code>) which are anything other than alphabets, numbers, and underscore. Hence, the third line from the <a href=\"https:\/\/smarttech101.com\/echo-with-examples\/\" target=\"_blank\" rel=\"noreferrer noopener\">echo command<\/a>&#8216;s output is matched, but not the fifth one.<\/li><li>If &#8220;jay&#8221; comes at the end of the line, it should be preceded by <code>\\W<\/code>. Hence, second line does not match, but the fourth line matches.<\/li><li>If &#8220;jay&#8221; comes in between the line, it should be both followed and preceded by <code>\\W<\/code>. The first line from the echo illustrates this.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"how-to-search-directly-for-a-line-using-grep\">How to search directly for a line using grep<\/h2>\n\n\n\n<p>To search for a line, use the flag <code>--line-regexp<\/code> or <code>-x<\/code>. Example &#8211;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\nit is not first line.\n\n&#91;ajay@lenovo ~]$ grep --line-regexp \"it is first line.\" file.txt\nit is first line.<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-pattern-in-grep\">What is PATTERN in grep command in Linux<\/h2>\n\n\n\n<p>There are four types of patterns in grep &#8211; extended regular expressions (EREs), fixed strings, basic regular expressions (BREs), and Perl-compatible regular expressions (PCREs).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"extended-regular-expressions-in-grep\">Extended Regular Expressions in grep<\/h3>\n\n\n\n<p>This is my favorite since I find myself using it most of the time. To use this, use the flag <code>-E<\/code> or <code>--extended-regexp<\/code>. <\/p>\n\n\n\n<p>The command <code>egrep<\/code> is the same as <code>grep --extended-regexp<\/code>. But, avoid using that since the <code>egrep<\/code> has been deprecated, and hence in the future,<code> it<\/code> might not work.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\nit is not first line.\n\n&#91;ajay@lenovo ~]$ grep --extended-regexp \"first|third\" file.txt\nit is first line.\nit is third line.\nit is not first line.<\/code><\/pre>\n\n\n\n<p>In the above example, grep will search for the &#8220;first&#8221; OR &#8220;third&#8221;. Here, is a table of the most widely used regular expressions and their meanings:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><thead><tr><th>Regular expression<\/th><th>Meaning<\/th><\/tr><\/thead><tbody><tr><td>.<\/td><td>any single character<\/td><\/tr><tr><td>*<\/td><td>the preceding item matching zero or more times<\/td><\/tr><tr><td>+<\/td><td>the preceding item matching one or more times<\/td><\/tr><tr><td>^<\/td><td>beginning of the line<\/td><\/tr><tr><td>$<\/td><td>end of the line<\/td><\/tr><tr><td>?<\/td><td>the preceding item is optional<\/td><\/tr><tr><td>[az]<\/td><td>the character \u201ca\u201d OR \u201cz\u201d<\/td><\/tr><tr><td>[a-z]<\/td><td>any letter from a to z (lowercase)<\/td><\/tr><tr><td>[A-Z]<\/td><td>any letter from A to Z (uppercase)<\/td><\/tr><tr><td>[A-Za-z]<\/td><td>any letter<\/td><\/tr><tr><td>[0-9]<\/td><td>any number<\/td><\/tr><tr><td>{n}<\/td><td>the preceding item matching exactly n times<\/td><\/tr><tr><td>{n,}<\/td><td>the preceding item matching n or more times<\/td><\/tr><tr><td>{,m}<\/td><td>the preceding item matching m or less than m times<\/td><\/tr><tr><td>{n,m}<\/td><td>the preceding item matching n to m times<\/td><\/tr><tr><td>\\s<\/td><td>any space character (space, horizontal and vertical tab, and newline, carriage return, formfeed)<\/td><\/tr><tr><td>\\S<\/td><td>any Non-whitespace character (i.e. exact opposite of \\s)<\/td><\/tr><\/tbody><\/table><figcaption>Table: The most widely used regular expressions and their meanings; source: man page<\/figcaption><\/figure>\n\n\n\n<p><strong>Note<\/strong>: the above meanings are only for the traditional C locale. In simple words, if your work is based on English then it should work fine.<\/p>\n\n\n\n<p>Regular expressions are extremely useful in Linux, Windows, and all programming languages. Therefore, I recommend you to have a look at <a href=\"https:\/\/smarttech101.com\/regular-expression-regex-and-regexp-in-linux-ft-grep\/\" target=\"_blank\" rel=\"noreferrer noopener\">my article on regular expressions<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"basic-regular-expression-in-grep\">Basic Regular Expressions in grep<\/h3>\n\n\n\n<p>For this, use the flag <code>-G<\/code> or <code>--basic-regexp<\/code>. This pattern is the <strong>default<\/strong> pattern. Therefore, if you do not provide any flag corresponding to these four patterns, grep will assume the given pattern to be the Basic Regular Expressions (BREs). <\/p>\n\n\n\n<p>For the GNU version of grep, basic (BREs) and Extended Regular Expressions (EREs) have the &#8220;<strong>same functionality<\/strong>&#8220;. To know if your grep is the GNU grep or not just search for the &#8220;GNU&#8221; word in the bottom line of the man page (<code>man grep<\/code>). If the &#8220;GNU&#8221; word is there, your grep is highly likely to be the GNU grep.<\/p>\n\n\n\n<p>The &#8220;same functionality&#8221; does not mean that the BREs&#8217; syntax is the same as that of the EREs. In BREs, meta-characters ?, +, {, |, (, and ) lose their special meaning. You need to prepend the backslashes to get back their special meanings. Example:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\nsecond line.\nit is third line.\nit is not first line.\n\n&#91;ajay@lenovo ~]$ grep \"first\\|third\" file.txt\nit is first line.\nit is third line.\nit is not first line.<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"perl-compatible-regular-expression\">Perl-Compatible Regular Expressions<\/h3>\n\n\n\n<p>In order to use this, you need the flag <code>--perl-regexp<\/code> or <code>-P<\/code>. <\/p>\n\n\n\n<p>This is much broader than the Extended Regular Expressions (EREs). For instance, non-greedy matching (<code>.*?<\/code>) is not available in the EREs, but in this, it is available.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ # greedy\n&#91;ajay@lenovo ~]$  echo \"smarttech101smarttechsmart\" | grep --extended-regexp --only-matching 'smart.*smart'\nsmarttech101smarttechsmart\n\n\n&#91;ajay@lenovo ~]$ # non-greedy\n&#91;ajay@lenovo ~]$ echo \"smarttech101smarttechsmart\" | grep --perl-regexp --only-matching 'smart.*?smart'\nsmarttech101smart<\/code><\/pre>\n\n\n\n<p>To know more about the Perl-regex, see the man pages (<code>man 3 pcresyntax<\/code> and <code>man 3 pcrepattern<\/code>).<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"fixed-strings-in-grep\">Fixed strings in grep<\/h3>\n\n\n\n<p>If you want the grep to interpret your searched string as a fixed string instead of the grep&#8217;s default basic regular expression, you need to use the flag <code>--fixed-strings<\/code> or <code>-F<\/code>.<\/p>\n\n\n\n<p>This becomes useful when your texts have a lot of regular expression metacharacters such as brackets, dash, star, dot, etc. Example &#8211; <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ cat file.txt\nit is first line.\n&#91;second line in bracket]\nthird line\n\n&#91;ajay@lenovo ~]$ cat file.txt | grep --fixed-strings \"&#91;\"\n&#91;second line in bracket]<\/code><\/pre>\n\n\n\n<p>One more thing to note is that just like <code>egrep<\/code>, there is <code>fgrep<\/code> equivalent to <code>grep --fixed-strings<\/code>. Both <code>fgrep<\/code> and <code>egrep<\/code> commands are deprecated and hence they can be removed in the future.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"grep_on_files_and_or_regex_starting_with_a_literal_dash\">Grep on files and\/or regex starting with a literal dash &#8211;<\/h2>\n\n\n\n<p>When you use grep with regexp starting with a <code>-<\/code>, you get errors such as below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ echo '00:02:03-00:05:45' | grep --extended-regexp --only-matching '-.*45'\ngrep: invalid option -- '.'\nUsage: grep &#91;OPTION]... PATTERNS &#91;FILE]...\nTry 'grep --help' for more information.<\/code><\/pre>\n\n\n\n<p>The reason is that grep considers this regex as another flag. Therefore, to prevent the grep from such consideration, use the end of the option notifier <code>--<\/code> as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;ajay@lenovo ~]$ echo '00:02:03-00:05:45' | grep --extended-regexp --only-matching -- '-.*45'\n-00:05:45<\/code><\/pre>\n\n\n\n<p>The same goes for a file. If a filename contains <code>-<\/code> at the beginning, you will get errors. Use <code>--<\/code> to avoid that.<\/p>\n\n\n\n<p>\ud83d\ude03 Fun Fact: Many Linux tools such as <code>touch<\/code>, and <code>ls<\/code> use <code>--<\/code> to indicate the end of the option. This coherency is one of the things I love about Linux.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"concluding-remarks\">Concluding Remarks<\/h2>\n\n\n\n<p>That was all about the basics of the grep command in Linux. I have tried my best to include as many examples as possible with every fact mentioned here &#8211; This is the hallmark of this blog <a href=\"https:\/\/smarttech101.com\/echo-with-examples\/\" target=\"_blank\" rel=\"noreferrer noopener\">smarttech101.com<\/a>. <\/p>\n\n\n\n<p>At the same time, I have tried to minimize errors as much as possible. But if there are still some inadvertent errors, please notify me using the comment section below. And if you have any problems, mention them in the comment section. I will be pleased to help you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article is about the grep command in Linux with examples &#8211; case insensitive search, types of regex, colored and numbered output.<\/p>\n","protected":false},"author":2,"featured_media":1813,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[17],"tags":[18],"class_list":["post-1785","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-command-line-tools","tag-command-line-tools"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Grep Command in Linux with Examples | SmartTech101<\/title>\n<meta name=\"description\" content=\"This article is about the grep command in Linux with examples - case insensitive search, types of regex, colored and numbered output.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smarttech101.com\/grep-command-in-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Grep Command in Linux with Examples | SmartTech101\" \/>\n<meta property=\"og:description\" content=\"This article is about the grep command in Linux with examples - case insensitive search, types of regex, colored and numbered output.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smarttech101.com\/grep-command-in-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"SmartTech101\" \/>\n<meta property=\"article:published_time\" content=\"2022-02-24T15:45:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-11-11T20:38:51+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ajay\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ajay_yadav\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ajay\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"12 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/\"},\"author\":{\"name\":\"Ajay\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334\"},\"headline\":\"Grep Command in Linux with Examples\",\"datePublished\":\"2022-02-24T15:45:00+00:00\",\"dateModified\":\"2022-11-11T20:38:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/\"},\"wordCount\":1778,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\"},\"image\":{\"@id\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png?fit=1280%2C720&ssl=1\",\"keywords\":[\"Command Line Tools\"],\"articleSection\":[\"Command Line Tools\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/smarttech101.com\/grep-command-in-linux\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/\",\"url\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/\",\"name\":\"Grep Command in Linux with Examples | SmartTech101\",\"isPartOf\":{\"@id\":\"https:\/\/smarttech101.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png?fit=1280%2C720&ssl=1\",\"datePublished\":\"2022-02-24T15:45:00+00:00\",\"dateModified\":\"2022-11-11T20:38:51+00:00\",\"description\":\"This article is about the grep command in Linux with examples - case insensitive search, types of regex, colored and numbered output.\",\"breadcrumb\":{\"@id\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/smarttech101.com\/grep-command-in-linux\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/#primaryimage\",\"url\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png?fit=1280%2C720&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png?fit=1280%2C720&ssl=1\",\"width\":1280,\"height\":720,\"caption\":\"grep command in Linux\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/smarttech101.com\/grep-command-in-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/smarttech101.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Grep Command in Linux with Examples\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/smarttech101.com\/#website\",\"url\":\"https:\/\/smarttech101.com\/\",\"name\":\"SmartTech101\",\"description\":\"Do Everything in Linux\",\"publisher\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/smarttech101.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633\",\"name\":\"Ajay Yadav\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1\",\"width\":180,\"height\":60,\"caption\":\"Ajay Yadav\"},\"logo\":{\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334\",\"name\":\"Ajay\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/smarttech101.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g\",\"caption\":\"Ajay\"},\"sameAs\":[\"https:\/\/x.com\/ajay_yadav\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Grep Command in Linux with Examples | SmartTech101","description":"This article is about the grep command in Linux with examples - case insensitive search, types of regex, colored and numbered output.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smarttech101.com\/grep-command-in-linux\/","og_locale":"en_US","og_type":"article","og_title":"Grep Command in Linux with Examples | SmartTech101","og_description":"This article is about the grep command in Linux with examples - case insensitive search, types of regex, colored and numbered output.","og_url":"https:\/\/smarttech101.com\/grep-command-in-linux\/","og_site_name":"SmartTech101","article_published_time":"2022-02-24T15:45:00+00:00","article_modified_time":"2022-11-11T20:38:51+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png","type":"image\/png"}],"author":"Ajay","twitter_card":"summary_large_image","twitter_creator":"@ajay_yadav","twitter_misc":{"Written by":"Ajay","Est. reading time":"12 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smarttech101.com\/grep-command-in-linux\/#article","isPartOf":{"@id":"https:\/\/smarttech101.com\/grep-command-in-linux\/"},"author":{"name":"Ajay","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334"},"headline":"Grep Command in Linux with Examples","datePublished":"2022-02-24T15:45:00+00:00","dateModified":"2022-11-11T20:38:51+00:00","mainEntityOfPage":{"@id":"https:\/\/smarttech101.com\/grep-command-in-linux\/"},"wordCount":1778,"commentCount":0,"publisher":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633"},"image":{"@id":"https:\/\/smarttech101.com\/grep-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png?fit=1280%2C720&ssl=1","keywords":["Command Line Tools"],"articleSection":["Command Line Tools"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/smarttech101.com\/grep-command-in-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/smarttech101.com\/grep-command-in-linux\/","url":"https:\/\/smarttech101.com\/grep-command-in-linux\/","name":"Grep Command in Linux with Examples | SmartTech101","isPartOf":{"@id":"https:\/\/smarttech101.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smarttech101.com\/grep-command-in-linux\/#primaryimage"},"image":{"@id":"https:\/\/smarttech101.com\/grep-command-in-linux\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png?fit=1280%2C720&ssl=1","datePublished":"2022-02-24T15:45:00+00:00","dateModified":"2022-11-11T20:38:51+00:00","description":"This article is about the grep command in Linux with examples - case insensitive search, types of regex, colored and numbered output.","breadcrumb":{"@id":"https:\/\/smarttech101.com\/grep-command-in-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smarttech101.com\/grep-command-in-linux\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/grep-command-in-linux\/#primaryimage","url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png?fit=1280%2C720&ssl=1","contentUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png?fit=1280%2C720&ssl=1","width":1280,"height":720,"caption":"grep command in Linux"},{"@type":"BreadcrumbList","@id":"https:\/\/smarttech101.com\/grep-command-in-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smarttech101.com\/"},{"@type":"ListItem","position":2,"name":"Grep Command in Linux with Examples"}]},{"@type":"WebSite","@id":"https:\/\/smarttech101.com\/#website","url":"https:\/\/smarttech101.com\/","name":"SmartTech101","description":"Do Everything in Linux","publisher":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smarttech101.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/e8d5aebc510d698e11e9df6291381633","name":"Ajay Yadav","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/","url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1","contentUrl":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/09\/cropped-ST101_logo.png?fit=180%2C60&ssl=1","width":180,"height":60,"caption":"Ajay Yadav"},"logo":{"@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/"}},{"@type":"Person","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/2edfee738a82f9c963210f8cdb438334","name":"Ajay","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smarttech101.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6eea348caae2173954765a7cdf6cd107?s=96&d=mm&r=g","caption":"Ajay"},"sameAs":["https:\/\/x.com\/ajay_yadav"]}]}},"jetpack_featured_media_url":"https:\/\/i0.wp.com\/smarttech101.com\/wp-content\/uploads\/2022\/02\/grep-1.png?fit=1280%2C720&ssl=1","_links":{"self":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/1785"}],"collection":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/comments?post=1785"}],"version-history":[{"count":5,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/1785\/revisions"}],"predecessor-version":[{"id":1964,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/posts\/1785\/revisions\/1964"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/media\/1813"}],"wp:attachment":[{"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/media?parent=1785"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/categories?post=1785"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smarttech101.com\/wp-json\/wp\/v2\/tags?post=1785"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}