Skip to content

Instantly share code, notes, and snippets.

@Chunlin-Li
Created January 16, 2016 08:53
Show Gist options
  • Save Chunlin-Li/63522f4696b443cd7ae0 to your computer and use it in GitHub Desktop.
Save Chunlin-Li/63522f4696b443cd7ae0 to your computer and use it in GitHub Desktop.
xargs usage

xargs 默认是单线程执行,如果要使用多线程并行执行, 需要 -P N 参数, 其中N是期望使用的线程数.

xargs -n 指定有标准输入传递进来的最大参数数量. 通常使用 -n 1

xargs -I {} 输入的参数的替代字符串, 可以用于指定输入参数在目标执行命令中的位置. 如 cat words.txt | xargs -n1 -I{} grep {} file.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment