Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
how to you delete multiple lines in a txt file using dos commands? these lines are all at the bottom of the txt file

If the lines are unique, let's say they look like:
one
two
three
four
five
sixYou can:
find /v "six" somefile | find /v "five" > newfile
If the lines are not unique, or if you want to delete the last x number of lines regardless of content, that's different.
M2
If at first you don't succeed, you're about average.

the lines (about 3-4,000) that i need to delete are all at the end of the file and are similar to the following:
wwwyyybbhhkjhf$
;lksdflksfsf$
qweporilkjdf$
;liasdjfosaddf$
;lksadhksdf$
the common components are the lines end with $thanks

Hi,
Do you want to do this with w2k?
[You're in the DOS forum.]
M2
If at first you don't succeed, you're about average.

There's no straightforward way that I know of to do it in DOS.
Are you willing to use a 3rd party utility?
M2
If at first you don't succeed, you're about average.

"yes i want to do this in dos!"
You mean the Win2K command prompt don't you?
That's not actually 'DOS'
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

If there was any lingering doubt that a forum name change would eliminate confusion, it has now been cleared up.
M2
If at first you don't succeed, you're about average.

"yes in DOS"
... sure it is.
Heh - doesn't seem to have made a great deal of impact. I'm always somewhat amazed that writers of complex batchfiles appear to be oblivious of the distinctionTime to break out the 'NT Command Prompt forum'??
Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.

jboy,
I thought maybe DOS=denial of sanity might help.
M2
If at first you don't succeed, you're about average.

Hi dtech10,
Yes, but only if none of the other lines [those to keep] contain $.
***
OP has not answered #7, so I guess we're not going to find out.M2
If at first you don't succeed, you're about average.

A common thread to all these posts. Everyone wants to do 'it' in 'DOS' or with a batch. 95% or more aren't capable of running real DOS. Most of them can be done using existing programs in whatever version of Windows they're using. Many appear to be an infrequent or singular occurrence of a 'problem'. Example this post. Just editing the file would fix yhe problem.
Those who use the command prompt have been elevated to the rank of merlin and this forum is now where the masses come to seek the magic.

Hi wizard-fred,
Yeah, some of this stuff pretty much defies comment.
There's one character with about six threads mostly about working up a list of music. Can't tell which is furthest out in the ozone. A couple folks tried to help, but it's pretty much help-resistant.
And I'm not dealing with that 'Roman Numeral' mess.
~SIGH~
M2
If at first you don't succeed, you're about average.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |