[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 543
  • Last Modified:

How would you convert the following .SRT file's contents into plain text via DOS command?

How would you convert the following .SRT file's contents into plain text stripping out the
line number and time information lines using DOS?

I have attached a .SRT file with the following contents:

I was hoping to convert the following .SRT file's contents from

6
00:00:27,000 --> 00:00:30,000
and build some simple webpages.

7
00:00:30,000 --> 00:00:33,000
Part of what makes web design and web development so fun

8
00:00:33,000 --> 00:00:37,000
when compared to other forms of software development, is that you can

to revised values as follows:

and build some simple webpages.
Part of what makes web design and web development so fun
when compared to other forms of software development, is that you can
TEST.txt
0
zimmer9
Asked:
zimmer9
  • 2
  • 2
1 Solution
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Can you try this:

findstr /v /r "[0-9] ^$" TEST.txt

note that lines containing both text and numbers would get filtered as well.

<edit>

This should do the trick:

findstr /v /r "^$ --> ^[0-9]*$" TEST.txt > TEST_stripped.txt
0
 
zimmer9Author Commented:
may I ask how you can redirect the output to another file, for ex: TESTOUT.txt
0
 
zimmer9Author Commented:
The numbers still appear in the output. For ex:

6
and build some simple webpages.

7
Part of what makes web design and web development so fun

8
when compared to other forms of software development, is that you can
0
 
Gerwin Jansen, EE MVETopic Advisor Commented:
Redirection to another output is shown above (> TEST_stripped.txt).

My output is this:

C:\Temp>type test.txt
6
00:00:27,000 --> 00:00:30,000
and build some simple webpages.

7
00:00:30,000 --> 00:00:33,000
Part of what makes web design and web development so fun

8
00:00:33,000 --> 00:00:37,000
when compared to other forms of software development, is that you can
C:\Temp>findstr /v /r "^$ --> ^[0-9]*$" test.txt > test_stripped.txt

C:\Temp>type test_stripped.txt
and build some simple webpages.
Part of what makes web design and web development so fun
when compared to other forms of software development, is that you can
C:\Temp>

Open in new window


test_stripped.txt has the output you requested, without the numbered lines and without the empty lines.

Did you copy/paste the findstr pattern correctly? There are (important) spaces in there, these are required.
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now