Solved

How to fine tune a DOS command to strip out the rows that represent line numbers within a file?

Posted on 2013-05-28
3
323 Views
Last Modified: 2013-05-30
How would you modify the following DOS Command which so far strips out the rows with semi colons, to convert the following file's contents into plain text stripping out the rows with line number using DOS?

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

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
3 Comments
 
LVL 53

Expert Comment

by:Bill Prew
ID: 39203241
I'm confused about what you want.  I ran that command against you test file and seem to get what you said you are looking for?

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

Open in new window

~bp
0
 
LVL 37

Expert Comment

by:Gerwin Jansen
ID: 39204004
Look at my answer in your previous question, I suspect you did not copy/paste the findstr pattern correctly.
0
 
LVL 53

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 39204258
If you want a slightly different means to the same end, you could try:

findstr /v /r /c:"^$" /c:"^[0-9]*$" /c:"^[0-9:,]* --> [0-9:,]*$" TEST.txt > TEST_stripped.txt

It uses the /v option to select lines NOT matching any of the regex patterns.

The first pattern "^$" eliminates an blank lines.

The second pattern "^[0-9]*$" eliminates any lines with just a number on them.

The third pattern "^[0-9:,]* --> [0-9:,]*$" eliminates the "time stamp" lines with the " --> " on them.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

813 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now