Skip to content

Instantly share code, notes, and snippets.

@fabito
Created September 10, 2020 04:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabito/989c5db84c3ea33f88772b02ab6c34d2 to your computer and use it in GitHub Desktop.
Save fabito/989c5db84c3ea33f88772b02ab6c34d2 to your computer and use it in GitHub Desktop.
split files
line_count=$(wc -l $1 | cut -d ' ' -f1)
<$1 | sort | split --additional-suffix=".txt" --numeric-suffixes="1" -l $(expr $line_count / $2 + $2 - 1) $1 "set"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment