How to pass command output as multiple arguments to another command

You can use xargs:

grep 'pattern' input | xargs -I% cp "%" "%.bac"

Leave a Comment