Skip to content

Instantly share code, notes, and snippets.

@xdel
Last active December 8, 2023 16:56
Show Gist options
  • Save xdel/ed0c17e94b0784ce4073a013804e8f18 to your computer and use it in GitHub Desktop.
Save xdel/ed0c17e94b0784ce4073a013804e8f18 to your computer and use it in GitHub Desktop.
SRT subtitle index offset fix
#/bin/sh
# note: the script is unable to distinguish between bare number being found
# in closed captions and the index itself, may be previous line's
# cr/crlf shoulf be handled in a proper way
COUNT=$1
FILENAME=$2
sed -i -r 's/^([0-9]+)\r$/echo "$((\1+'$COUNT'))"/ge' $FILENAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment