This should be an absurdly easy task: I want to take each line of the stdout of any old command, and use each to execute another command with it as an argument.
For example:
ls | grep foo | applycommand 'mv %s bar/'
Where this would take everything matching "foo" and move it to the bar/ directory.
(I feel a bit embarrassed asking for what is probably a ridiculously obvious solution.)
That program is called xargs
.
ls | grep foo | xargs -I %s mv %s bar/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With