Last active
July 4, 2022 03:29
-
-
Save nemolize/a65bf77f19a4edac1d4802858485aac4 to your computer and use it in GitHub Desktop.
Example of arg splitting for parallel execution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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