Skip to content

Instantly share code, notes, and snippets.

@neuthral
Created October 9, 2022 21:52
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 neuthral/cea8067c4dd5630b4b8f15bf9be9f785 to your computer and use it in GitHub Desktop.
Save neuthral/cea8067c4dd5630b4b8f15bf9be9f785 to your computer and use it in GitHub Desktop.
clean youtube subtitle files and clean-up them for reading
echo $1
echo "Removing --> time stuff"
sed -i '/-->/d' $1
echo "Removing empty lines"
grep "\S" $1 > $1.txt
echo "wrap long lines to 96 characters"
fold -sw 96 $1.txt > $1.txt.fix
echo "renaming file extension"
rename 's/\.en.vtt.txt.fix$/.txt/' *.fix
echo "Deleting old subtitle file"
rm $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment