xargs: Replace tokens with arg
31 May 2023 (Updated 19 September 2023)
On this page
In a nutshell
ls -l | awk '{print $9}' | xargs -I '{}' echo "File: {}"
Anywhere you use $
, it will be replaced by the value piped to xargs.
Example
An example command to update latest versions of NPM packages that have storybook
in their name:
npm outdated | grep storybook | awk '{print $1}' | xargs -I '{}' npm i "{}@latest"
Tagged:
Bash
Thanks for your comment 🙏. Once it's approved, it will appear here.
Leave a comment