Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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