Name

apply

Synopsis

    apply [options] command argument ...

Apply command to one or more of the following arguments in turn. command may contain a % followed by a digit from 1 to 9. Such text is replaced with the corresponding following unused argument.

Options

- N

Use arguments in groups of N. For example, -2 uses two arguments for each invocation of command. Occurrences of % N in command override this option.

-a char

Use char instead of % as the special character to represent arguments.

-d

Display the commands that would be executed, but don’t actually execute them.

Example

Run awk against multiple test programs and data. The example uses brace expansion as in Bash and tcsh:

    apply -2 'awk -f' test1.{awk,in} test2.{awk,in} test3.{awk,in}

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.