Solved

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

Posted on 2013-05-28
4
538 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 38

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 38

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Folder replication and file move 3 82
how to roll into all sub dirs 7 64
command prompt output to file and show the output at the same time 4 71
Upgrade dos 4.00.1111 11 65
One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

737 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