[xargs] Insert each input line into an argument

Created on November 30, 2026

Use xargs -I to replace a placeholder in the command arguments. This example substitutes one input line at a time for {}.

printf '%s\n' apple banana | xargs -I {} echo 'fruit:{}'
fruit:apple
fruit:banana

The replacement can appear inside an argument, as it does here after fruit:.

Reference

Shell command xargs