Skip to content

.tip

· one of the small things

xargs -I puts the argument where you need it

By default xargs tacks arguments onto the end of the command. -I {} names a placeholder you can put anywhere, once per input line.

cat slugs.txt | xargs -I {} curl -s -o /dev/null -w '{} %{http_code}\n' https://example.com/tips/{}

-I implies one argument per command, so it's slower than batching. But when you need the value in the middle of the command, it's the only way.

shell