Skip to content

Instantly share code, notes, and snippets.

@shmerl
Last active January 8, 2022 17:38
Show Gist options
  • Save shmerl/9df260cfa157c2c86772 to your computer and use it in GitHub Desktop.
Save shmerl/9df260cfa157c2c86772 to your computer and use it in GitHub Desktop.
#!/bin/bash
source="$1"
source_size=$(stat -c %s "$source")
offsets=( $(grep --only-matching --byte-offset --binary --text Creative "$source" | cut -d : -f 1) )
# setting the last offset to the size of the file
offsets[${#offsets[@]}]=$source_size
for ((i = 0; i < $(( ${#offsets[@]} - 1 )); i++)); do
left=${offsets[$i]}
right=${offsets[$((i+1))]}
dd skip=$left count=$(($right - $left)) if=$source of=${source%.*}_${i}.voc bs=1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment