{
    "content": [
        {
            "type": "text",
            "text": "# sg (man)\n\n## NAME\n\nsg - execute command as different group ID\n\n## SYNOPSIS\n\nsg [-] [group [-c ] command]\n\n## DESCRIPTION\n\nThe sg command works similar to newgrp but accepts a command. The command will be executed\nwith the /bin/sh shell. With most shells you may run sg from, you need to enclose multi-word\ncommands in quotes. Another difference between newgrp and sg is that some shells treat newgrp\nspecially, replacing themselves with a new instance of a shell that newgrp creates. This\ndoesn't happen with sg, so upon exit from a sg command you are returned to your previous\ngroup ID.\n\n## TLDR\n\n> Ast-grep is a tool for code structural search, lint, and rewriting.\n\n- Scan for possible queries using interactive mode:\n  `sg scan --interactive`\n- Rewrite code in the current directory using patterns:\n  `sg run --pattern '{{foo}}' --rewrite '{{bar}}' --lang {{python}}`\n- Visualize possible changes without applying them:\n  `sg run --pattern '{{useState<number>($A)}}' --rewrite '{{useState($A)}}' --lang {{typescript}}`\n- Output results as JSON, extract information using `jq` and interactively view it using `jless`:\n  `sg run --pattern '{{Some($A)}}' --rewrite '{{None}}' --json | jq '{{.[].replacement}}' | jless`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **CONFIGURATION** (1 subsections)\n- **FILES**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "sg",
        "section": "",
        "mode": "man",
        "summary": "sg - execute command as different group ID",
        "synopsis": "sg [-] [group [-c ] command]",
        "tldr_summary": "Ast-grep is a tool for code structural search, lint, and rewriting.",
        "tldr_examples": [
            {
                "description": "Scan for possible queries using interactive mode",
                "command": "sg scan --interactive"
            },
            {
                "description": "Rewrite code in the current directory using patterns",
                "command": "sg run --pattern '{{foo}}' --rewrite '{{bar}}' --lang {{python}}"
            },
            {
                "description": "Visualize possible changes without applying them",
                "command": "sg run --pattern '{{useState<number>($A)}}' --rewrite '{{useState($A)}}' --lang {{typescript}}"
            },
            {
                "description": "Output results as JSON, extract information using `jq` and interactively view it using `jless`",
                "command": "sg run --pattern '{{Some($A)}}' --rewrite '{{None}}' --json | jq '{{.[].replacement}}' | jless"
            }
        ],
        "tldr_source": "official",
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "id",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/id/1/json"
            },
            {
                "name": "login",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/login/1/json"
            },
            {
                "name": "newgrp",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/newgrp/1/json"
            },
            {
                "name": "su",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/su/1/json"
            },
            {
                "name": "gpasswd",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/gpasswd/1/json"
            },
            {
                "name": "group",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/group/5/json"
            },
            {
                "name": "gshadow",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/gshadow/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "CONFIGURATION",
                "lines": 2,
                "subsections": [
                    {
                        "name": "SYSLOG___SG___ENAB (boolean)",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "FILES",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "sg - execute command as different group ID\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "sg [-] [group [-c ] command]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The sg command works similar to newgrp but accepts a command. The command will be executed\nwith the /bin/sh shell. With most shells you may run sg from, you need to enclose multi-word\ncommands in quotes. Another difference between newgrp and sg is that some shells treat newgrp\nspecially, replacing themselves with a new instance of a shell that newgrp creates. This\ndoesn't happen with sg, so upon exit from a sg command you are returned to your previous\ngroup ID.\n",
                "subsections": []
            },
            "CONFIGURATION": {
                "content": "The following configuration variables in /etc/login.defs change the behavior of this tool:\n",
                "subsections": [
                    {
                        "name": "SYSLOG___SG___ENAB (boolean)",
                        "content": "Enable \"syslog\" logging of sg activity.\n"
                    }
                ]
            },
            "FILES": {
                "content": "/etc/passwd\nUser account information.\n\n/etc/shadow\nSecure user account information.\n\n/etc/group\nGroup account information.\n\n/etc/gshadow\nSecure group account information.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "id(1), login(1), newgrp(1), su(1), gpasswd(1), group(5), gshadow(5).\n\n\n\nshadow-utils 4.8.1                           02/06/2024                                        SG(1)",
                "subsections": []
            }
        }
    }
}