Skip to content

Instantly share code, notes, and snippets.

@epcim
Last active June 18, 2019 20:05
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 epcim/b0c4f56bc30fc6dcf9bf0b94e957f4b4 to your computer and use it in GitHub Desktop.
Save epcim/b0c4f56bc30fc6dcf9bf0b94e957f4b4 to your computer and use it in GitHub Desktop.
split needle csplit
# example usage: to split yaml with multiple documents
needle() {
SUFFIX=${1##*.}
NEEDLE=${2:----}
csplit -b "%03d.$SUFFIX" -zsf $(basename $1 .$SUFFIX) $1 /$NEEDLE/+1 {*}
}
needle vega-objects.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment