Solved

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

Posted on 2013-05-28
4
530 Views
Last Modified: 2013-05-29
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
Comment
Question by:zimmer9
  • 2
  • 2
4 Comments
 
LVL 37

Accepted Solution

by:
Gerwin Jansen, EE MVE earned 500 total points
ID: 39202701
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
 

Author Comment

by:zimmer9
ID: 39202774
may I ask how you can redirect the output to another file, for ex: TESTOUT.txt
0
 

Author Comment

by:zimmer9
ID: 39202786
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
 
LVL 37

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 39203968
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question