{
    "mode": "man",
    "parameter": "ptargrep",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/ptargrep/1/json",
    "generated": "2026-09-06T15:16:15Z",
    "synopsis": "ptargrep [options] <pattern> <tar file> ...\nOptions:\n--basename|-b     ignore directory paths from archive\n--ignore-case|-i  do case-insensitive pattern matching\n--list-only|-l    list matching filenames rather than extracting matches\n--verbose|-v      write debugging message to STDERR\n--help|-?         detailed help message",
    "sections": {
        "NAME": {
            "content": "ptargrep - Apply pattern matching to the contents of files in a tar archive\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ptargrep [options] <pattern> <tar file> ...\n\nOptions:\n\n--basename|-b     ignore directory paths from archive\n--ignore-case|-i  do case-insensitive pattern matching\n--list-only|-l    list matching filenames rather than extracting matches\n--verbose|-v      write debugging message to STDERR\n--help|-?         detailed help message\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This utility allows you to apply pattern matching to the contents of files contained in a tar\narchive.  You might use this to identify all files in an archive which contain lines matching\nthe specified pattern and either print out the pathnames or extract the files.\n\nThe pattern will be used as a Perl regular expression (as opposed to a simple grep regex).\n\nMultiple tar archive filenames can be specified - they will each be processed in turn.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "--basename (alias -b)\nWhen  matching  files are extracted, ignore the directory path from the archive and write\nto the current directory using the basename of the file from the archive.  Beware: if two\nmatching files in the archive have the same basename,  the  second  file  extracted  will\noverwrite the first.\n\n--ignore-case (alias -i)\nMake pattern matching case-insensitive.\n\n--list-only (alias -l)\nPrint  the  pathname  of  each  matching  file  from the archive to STDOUT.  Without this\noption, the default behaviour is to extract each matching file.\n\n--verbose (alias -v)\nLog debugging info to STDERR.\n\n--help (alias -?)\nDisplay this documentation.\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright 2010 Grant McLean <grantm@cpan.org>\n\nThis program is free software; you can redistribute it and/or modify it under the same  terms\nas Perl itself.\n\nperl v5.38.2                                 2026-06-12                                  PTARGREP(1)",
            "subsections": []
        }
    },
    "summary": "ptargrep - Apply pattern matching to the contents of files in a tar archive",
    "flags": [],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Find `regex` patterns in `.tar` archive files.",
        "examples": [
            {
                "description": "Search for a pattern within one or more `.tar` archives",
                "command": "ptargrep \"{{search_pattern}}\" {{path/to/file1 path/to/file2 ...}}"
            },
            {
                "description": "Extract to the current directory using the basename of the file from the archive",
                "command": "ptargrep {{-b|--basename}} \"{{search_pattern}}\" {{path/to/file}}"
            },
            {
                "description": "Search for a case-insensitive pattern matching within a `.tar` archive",
                "command": "ptargrep {{-i|--ignore-case}} \"{{search_pattern}}\" {{path/to/file}}"
            }
        ]
    }
}