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
325 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
[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
3 Comments
 
LVL 54

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 38

Expert Comment

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

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 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