xargs
allows you to transform inputs from one command and run them with another command.
By default xargs
takes input, separates it by blanks, and executes a command for each argument. Example:
echo 'one two three' | xargs mkdir # This will make three directories
Useful arguments:
-d
: Change the delimiter to something other than space, i.e. xargs -d "\n"
-p
: Display each command and prompt the user to execute it