4 ms·
"What xargs is doing is taking each line of input and applying the supplied argument or command to the line of input" Actually it does not run command once for
by gizzlon 14y ago
"What xargs is doing is taking each line of input and applying the supplied argument or command to the line of input"
Actually it does not run command once for each line of input. This confused me for some time until I read the man page:
"The command line for command is built up until it reaches a system-defined limit (unless the -n and -L options are used). The specified command will be invoked as many times as necessary to use up the list of input items. In general, there will be many fewer invocations of command than there were items in the input. This will normally have significant performance benefits. Some commands can usefully be executed in parallel too; see the -P option"
Think you're looking for "-n 1" if you want that behavior..
- leed25d 14y agoI was going to respond on this very point myself. This blog entry is just plain wrong wrt the way that xargs works.