{ "name": "xargs", "section": 1, "title": "construct argument lists and invoke utility", "synopsis": [ "xargs [-0] [-I repl] [-n maxargs] [--] [utility [argument ...]]" ], "description": "Reads stdin, splits into words (or null-terminated records with -0), and invokes the utility via ctx.runBinCommand in batches. Enforces fixed limits on stdin size, token count, arguments per run, and total invocations.", "options": [ { "flag": "-0, --null", "meaning": "Input items are separated by null bytes instead of whitespace" }, { "flag": "-n maxargs, --max-args maxargs", "meaning": "Use at most maxargs arguments from stdin per utility invocation (capped at 128)" }, { "flag": "-I repl, -irepl", "meaning": "Replace repl in utility arguments with each input item (implies -n 1 unless -n is set)" } ], "keywords": ["xargs", "arguments", "bare-os", "coreutils"], "bareOsNotes": "No host fork; subset of POSIX/GNU xargs. See src/xargs.js for numeric limits.", "examples": [ { "caption": "pass lines as arguments", "code": "printf 'a\\nb\\n' | xargs echo" }, { "caption": "one argument per run", "code": "printf 'a\\nb\\n' | xargs -n1 echo" }, { "caption": "workaround for complex scripts", "code": "# for f in *.txt; do grep -l foo $f; done" } ], "listCategory": "coreutils" }