Skip to content

Instantly share code, notes, and snippets.

@shawwn
Created January 17, 2020 00:27
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 shawwn/9fbe140e13126b7460662ce0ae76ec3b to your computer and use it in GitHub Desktop.
Save shawwn/9fbe140e13126b7460662ce0ae76ec3b to your computer and use it in GitHub Desktop.
#!/bin/sh
#https://stackoverflow.com/questions/11313852/split-one-file-into-multiple-files-based-on-delimiter
set -ex
token="${1}"
shift 1
outfile="${1}"
shift 1
exec awk "{print \$0 > "$outfile" NR ".txt"}" RS="$token" "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment