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
324 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 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 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Title # Comments Views Activity
Question to Zip 8 90
find and replace 5 51
Batch Script for opening the DOS prompt and run a command 9 115
file size 9 53
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…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

828 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