Created
October 9, 2022 21:52
-
-
Save neuthral/cea8067c4dd5630b4b8f15bf9be9f785 to your computer and use it in GitHub Desktop.
clean youtube subtitle files and clean-up them for reading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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