TG Telegram Group & Channel
GeekTips | United States America (US)
Create: Update:

replace srt / vrt index numbers in subtitles...not really needed. In VSCode can simply do search for (^\d+\n) and replace (nothing) ...but to do in a script is much harder it appears. Here's what I found after lots of searching.

This one removes the number starting at beginning of a line and appends a newline but that creates two newlines (two empty lines)
sed -i 'N;s|^[0-9]\+||' test.vtt

Now to search for two empty lines and just remove one of them.

sed -i '/^$/{ :l N; s/^\n$//; t l p; d; }' test.vtt

So I guess I'll just stick with the first method.

sed -i 'N;s|^[0-9]\+||' test.vtt

So it went from 4.4MB down to 4.3MB so hmmm maybe not that much of a difference. Ok just did another one it went from 7.4MB to 6.8MB ..so it's a bit.

replace srt / vrt index numbers in subtitles...not really needed. In VSCode can simply do search for (^\d+\n) and replace (nothing) ...but to do in a script is much harder it appears. Here's what I found after lots of searching.

This one removes the number starting at beginning of a line and appends a newline but that creates two newlines (two empty lines)
sed -i 'N;s|^[0-9]\+||' test.vtt

Now to search for two empty lines and just remove one of them.

sed -i '/^$/{ :l N; s/^\n$//; t l p; d; }' test.vtt

So I guess I'll just stick with the first method.

sed -i 'N;s|^[0-9]\+||' test.vtt

So it went from 4.4MB down to 4.3MB so hmmm maybe not that much of a difference. Ok just did another one it went from 7.4MB to 6.8MB ..so it's a bit.


>>Click here to continue<<

GeekTips







Share with your best friend
VIEW MORE

United States America Popular Telegram Group (US)