{
    "content": [
        {
            "type": "text",
            "text": "# grep (perldoc)\n\n## TLDR\n\n> Find patterns in files using `regex`es.\n\n- Search for a pattern within files:\n  `grep \"{{search_pattern}}\" {{path/to/file1 path/to/file2 ...}}`\n- Search for an exact string (disables `regex`es):\n  `grep {{-F|--fixed-strings}} \"{{exact_string}}\" {{path/to/file}}`\n- Search for a pattern in all files recursively in a directory, ignoring binary files:\n  `grep {{-rI|--recursive --binary-files=without-match}} \"{{search_pattern}}\" {{path/to/directory}}`\n- Print 3 lines of [C]ontext around, [B]efore, or [A]fter each match:\n  `grep {{-context|--before-context|--after-context}} 3 \"{{search_pattern}}\" {{path/to/file}}`\n- Print file name and line number for each match with color output:\n  `grep {{-Hn|--with-filename --line-number}} --color=always \"{{search_pattern}}\" {{path/to/file}}`\n- Print only the matched text:\n  `grep {{-o|--only-matching}} \"{{search_pattern}}\" {{path/to/file}}`\n- Read data from `stdin` and do not print lines that match a pattern:\n  `cat {{path/to/file}} | grep {{-v|--invert-match}} \"{{search_pattern}}\"`\n- Use extended `regex`es (supports `?`, `+`, `{}`, `()`, and `|`), in case-insensitive mode:\n  `grep {{-Ei|--extended-regexp --ignore-case}} \"{{search_pattern}}\" {{path/to/file}}`\n\n*Source: tldr-pages*\n\n---\n\n## Full Content\n\n"
        }
    ],
    "structuredContent": {
        "command": "grep",
        "section": "-f",
        "mode": "perldoc",
        "summary": null,
        "synopsis": null,
        "tldr_summary": "Find patterns in files using `regex`es.",
        "tldr_examples": [
            {
                "description": "Search for a pattern within files",
                "command": "grep \"{{search_pattern}}\" {{path/to/file1 path/to/file2 ...}}"
            },
            {
                "description": "Search for an exact string (disables `regex`es)",
                "command": "grep {{-F|--fixed-strings}} \"{{exact_string}}\" {{path/to/file}}"
            },
            {
                "description": "Search for a pattern in all files recursively in a directory, ignoring binary files",
                "command": "grep {{-rI|--recursive --binary-files=without-match}} \"{{search_pattern}}\" {{path/to/directory}}"
            },
            {
                "description": "Print 3 lines of [C]ontext around, [B]efore, or [A]fter each match",
                "command": "grep {{-context|--before-context|--after-context}} 3 \"{{search_pattern}}\" {{path/to/file}}"
            },
            {
                "description": "Print file name and line number for each match with color output",
                "command": "grep {{-Hn|--with-filename --line-number}} --color=always \"{{search_pattern}}\" {{path/to/file}}"
            },
            {
                "description": "Print only the matched text",
                "command": "grep {{-o|--only-matching}} \"{{search_pattern}}\" {{path/to/file}}"
            },
            {
                "description": "Read data from `stdin` and do not print lines that match a pattern",
                "command": "cat {{path/to/file}} | grep {{-v|--invert-match}} \"{{search_pattern}}\""
            },
            {
                "description": "Use extended `regex`es (supports `?`, `+`, `{}`, `()`, and `|`), in case-insensitive mode",
                "command": "grep {{-Ei|--extended-regexp --ignore-case}} \"{{search_pattern}}\" {{path/to/file}}"
            }
        ],
        "tldr_source": "official",
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [],
        "sections": []
    }
}