Jump to content
Sub-Talk.net - TV shows community
Pindiu

Help with editing please

Recommended Posts

Pindiu

I have a set of 4 .srt files, and they all have extra numbers in each line that I need to edit out. e.g.

631
00:29:29,240 --> 00:29:31,760
Some text here.
632
632

632
00:29:31,800 --> 00:29:36,280
More text here.
633
633

Each number is there twice, and they are consecutive - +1 for each line.

Using Subtitle Edit, I can't seem to find a way to automatically delete them - Find & Replace doesn't work as each number is different.
I really don't want to have to edit each and every line - does anyone have any suggestions please?

Share this post


Link to post
Share on other sites
forgetit

Try notepad++, menu Edit, Line operations, Remove (consecutive) duplicate lines.

https://notepad-plus-plus.org/

Edited by forgetit
  • Like 2

Share this post


Link to post
Share on other sites
VelaOmsk

Hi. You need a program to remove duplicate lines. Try https://ibox.tools/remove-duplicates
If it removes spaces, then load the result into Subtitle Edit.
If that doesn't work, upload a sample subtitle here to try other ways.

 

P.S. I didn't see that forgetit had already suggested a better solution.

Edited by VelaOmsk
  • Like 1

Share this post


Link to post
Share on other sites
Pindiu

Thank you for your replies. Bedtime here now, so I'll try your methods tomorrow.

But I fear removing duplicates will only remove one of the numbers per subtitle line, not both. I need both to be gone.

Share this post


Link to post
Share on other sites
TestosteronnieFlex

This might remove more than what you asked for, but could also work 🤷‍♂️: in Subtitle Edit, go to Edit -> Replace, put

^\d\d\d

into Find what: and leave Replace with blank. Select Regular expression (not something I'm particularly knowledgeable about) and replace all.

Then a Fix common errors with Remove unneeded spaces should get rid of the left over line breaks.

 

EDIT: that's also a pretty bad regex, TBH, because I don't know regexes. Maybe add a \d? to the end if it misses some

Edited by TestosteronnieFlex
  • Like 1

Share this post


Link to post
Share on other sites
forgetit

That will remove all the three digit lines, while one should remain. Also does not work for the one and two digit lines at the start of the sub.

This *might* work:

^\d+\r\n\d+$

  • Like 2

Share this post


Link to post
Share on other sites
Alice

These "line numbers" are part of a subtitle sequence.
That is, Subtitle Edit treats them as part of the text, not an actual new line, or more accurately, sequence.
I don't know if @VelaOmsk's suggestion works.
@forgetit's and @TestoteronnnieFlex's approaches won't work, I'm afraid.
@forgetit's suggestion to use notepad++ does remove one of the duplicates.

I know nothing about regex, but, for what I gather, in order to remove these duplicates one would require some code doing something like this:
"Remove all consecutive lines of text that contain only digits
up to the one that has as next line an empty one. (or back-to-back line breaks)"

 

  • Like 2

The chickens are revolting!

Share this post


Link to post
Share on other sites
VelaOmsk

Pindiu, you can give us the subtitles if they're not secret, we'll try what we can do.

Edited by VelaOmsk
  • Like 1

Share this post


Link to post
Share on other sites
forgetit

My regex works in notepad++. In subtitleedit it might work in the source view.

  • Like 1

Share this post


Link to post
Share on other sites
Alice
47 minutes ago, forgetit said:

My regex works in notepad++. In subtitleedit it might work in the source view.

I was having only SE in mind, and failed to test notepad.
Thanx for the input, @forgetit.
And no, I tested both views, column and source, on SE.


The chickens are revolting!

Share this post


Link to post
Share on other sites
Pindiu
53 minutes ago, forgetit said:

My regex works in notepad++. In subtitleedit it might work in the source view.

Forgetit's method using notepad++ worked brilliantly.

Thank you all very much for the suggestions!  :smiley-signs101:

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Member Statistics

    24,131
    Total Members
    6,268
    Most Online
    HilaleLeon
    Newest Member
    HilaleLeon
    Joined
×
×
  • Create New...