gtpo1m6eOperations

ZFILE xargs-Construct an Argument List and Run a Command

Use this command to build and run additional commands. The ZFILE xargs command accepts arguments passed from the standard input (stdin) stream, completes and runs the command.

Requirements and Restrictions

Format




-n number
specifies the number of arguments processed at a time from stdin by the ZFILE xargs command, where number is a whole number greater than 0. For example:
zfile find . -name "*.c" | xargs -n 2 echo

takes two arguments at a time from the results of the ZFILE find command and passes them to the ZFILE echo command, or echo. Once the ZFILE echo command is run, the process repeats until there are no more arguments in stdin.

-t
writes the contents of stdin to standard error (stderr) before the arguments are processed by the command specified in the funcmsg parameter. This allows you to see the original information that was passed through the ZFILE xargs command to funcmsg.

-x
ends the ZFILE xargs command if stdin is larger than the number of bytes specified by -s size. If the -s parameter is not specified, the -x parameter will be activated when stdin is larger than system variable LINE_MAX, which is currently defined as 2048 bytes.

-s size
sets the maximum number of bytes of the argument list, where size is a whole number greater than 0 but less than or equal to system variable LINE_MAX, which is currently defined as 2048 bytes.

funcmsg
specifies the command to run using the information in stdin. Do not type the ZFILE portion of the command again, but rather just the keyword such as echo or grep. If no command is specified, stdin is passed to the ZFILE echo command.

argument
specifies a parameter needed to run the operation indicated in funcmsg.

Additional Information

Examples

The following example first writes the results of the ZFILE find command to stderr and then searches those files by using the ZFILE grep command to locate files that contain string rmdir.

+---------------------------------------------------------------------------------------------+
|User:   ZFILE find . -name '*.t' | xargs -t grep rmdir                                       |
|                                                                                             |
|System: FILE0001I 08:14:31 START OF DISPLAY FROM find . -name '*.t' | xargs -t ...           |
|        ./test.t: rmdir 'tmp'                                                                |
|        ./xyz.t: rmdir 'temp'                                                                |
|        END OF DISPLAY                                                                       |
|                                                                                             |
|System: FILE0001I 08:14:31 START OF ERROR DISPLAY FROM find . -name '*.t'| xargs -t ...      |
|        grep echo ./abc.t ./new.t ./test.t ./xyz.t                                           |
|        END OF DISPLAY                                                                       |
+---------------------------------------------------------------------------------------------+

The following example uses three columns to display the file names that end in .c in or below the current directory.

+---------------------------------------------------------------------------------------------+
|User:   ZFILE find . -name "*.c" | xargs -n 3 echo                                           |
|                                                                                             |
|System: FILE0001I 08:14:31 START OF DISPLAY FROM find . -name "*.c" | xargs -n 3 echo        |
|        ./file1.c  ./file2.c  ./file3.c                                                      |
|        ./file4.c  ./file5.c  ./file6.c                                                      |
|        END OF DISPLAY                                                                       |
+---------------------------------------------------------------------------------------------+

The following example uses the -s parameter to set the maximum argument list size to 50 bytes and then displays all files that end in .c in or below the current directory.

+---------------------------------------------------------------------------------------------+
|User:   ZFILE find . -name "*.c" | xargs -s50                                                |
|                                                                                             |
|System: FILE0001I 08:14:31 START OF DISPLAY FROM find . -name "*.c" | xargs -s50             |
|        ./file1.c  ./file2.c  ./file3.c  ./file4.c                                           |
|        ./file5.c  ./file6.c                                                                 |
|        END OF DISPLAY                                                                       |
+---------------------------------------------------------------------------------------------+

The following example uses the -s parameter to set the maximum argument list size to 50 bytes. The -x parameter limits the size of the input from the ZFILE find command to 50 bytes. The input is larger than 50 bytes so the ZFILE xargs command exits.

+---------------------------------------------------------------------------------------------+
|User:   ZFILE find . -name "*.c" | xargs -s50 -x                                             |
|                                                                                             |
|System: FILE0001I 08:14:31 START OF DISPLAY FROM find . -name "*.c" | xargs -s...            |
|        xargs: insufficient space for arguments                                              |
|        END OF DISPLAY                                                                       |
+---------------------------------------------------------------------------------------------+

Related Information