Shell commandsXargs
Build and execute command lines from standard input
Xargs can be readStdinAnd use a space character or line break character as the resolutionStdinData is separatedArguments.
1) Description
Xargs [-0epn] command
Options and parameters:
-0: If the input stdin contains special characters, for example, ', \, when the blank key and other characters, this
-E: This is EOF (end of file) . A string can be followed when xargs when this string is parsed, it stops working!
-P: InArgumentWill ask the user's meaning;
-N: Number of followed calls, each timeCommandWhen executing a command, several parameters are required.
WhenXargsWhen no command is followed, the default isEchoOutput!
2) Example
Cut-d ":"-F1/etc/passwd | tail-N 5 | xargs finger
3) UseXargsThe reason is that many commands do not actually support pipeline commands, so we canXargsTo provide this command referenceStandard Input.
Find./-name Prime. cpp | LS-l // The output is not what we think, becauseLsMPs queue is not supported.
Find./-name Prime. cpp | xargs LS-l
Original
[1]Http://linux.vbird.org/linux_basic/0320bash.php