man(1) Manual page archive


     APPLY(1)                                                 APPLY(1)

     NAME
          apply, pick - repeatedly apply a command; select arguments

     SYNOPSIS
          apply [ -ac ] [ -n ] command arg ...

          pick [ arg ... ]

     DESCRIPTION
          Apply runs the named command on each argument arg in turn.
          Normally arguments are chosen singly; the optional number n
          specifies the number of arguments to be passed to command.
          If n is zero, command is run without arguments once for each
          arg. Character sequences of the form %d in command, where d
          is a digit from 1 to 9, are replaced by the dth following
          unused arg. If any such sequences occur, n is ignored, and
          the number of arguments passed to command is the maximum
          value of d in command. The character `%' may be changed by
          the -a option.

          Pick writes each argument to the standard error and reads a
          reply.  If the reply is `y', the argument is echoed to the
          standard output; if the reply is `q', pick exits without
          reading any more arguments; there is no output for any other
          response.  If there are no arguments, lines of the standard
          input are taken instead.

     EXAMPLES
          apply echo *
               Time-consuming way to do `ls'.

          apply -2 cmp a1 b1 a2 b2
               Compare the `a' files to the `b' files.

          wc -l `pick *.[ch]`
               Interactively select `.c' and `.h' files and count the
               lines in each.

          apply "wc -l %1" `pick *.[ch]`
               Same, but use a separate process to count each file.

     SEE ALSO
          sh(1)

     BUGS
          There is no way to pass a literal `%2' if `%' is apply's
          argument expansion character.