4 ms·
I agree, this is one of my favorite tricks. I like to think of xargs as a `map` function over stdin lines. As the article mentions, especially useful when comb
by jnpatel 11y ago
I agree, this is one of my favorite tricks. I like to think of xargs as a `map` function over stdin lines.
As the article mentions, especially useful when combined with the -P flag for paralellism.
cat urlpaths.txt | xargs -I{} -P wget domain.com/{}
Another handy trick, is to use `sh -c` or `bash -c` to include multiple commands with xargs.
cat dirs.txt | xargs -I{} sh -c 'cd {}; touch file;'