Skip to content

Instantly share code, notes, and snippets.

@nemolize
Last active July 4, 2022 03:29
Show Gist options
  • Save nemolize/a65bf77f19a4edac1d4802858485aac4 to your computer and use it in GitHub Desktop.
Save nemolize/a65bf77f19a4edac1d4802858485aac4 to your computer and use it in GitHub Desktop.
Example of arg splitting for parallel execution
#!/usr/bin/env bash
ARGS='a b c d e' # replace this with your test file paths
GROUP_SIZE=2
NTH_OF_GROUPS=2
# outputs "c d"
echo "${ARGS}" | xargs -n "${GROUP_SIZE}" echo | sed -n "${NTH_OF_GROUPS}p"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment