L
L
Luan2019-01-19 18:30:17
cmd/bat
Luan, 2019-01-19 18:30:17

Is it possible to change lines in a text file through a bat file?

You need to add the same value to several files, while deleting the old ones and replacing them with new ones. But in each file, the desired value is located in different lines, and in some of them there are others before the desired value that must be left.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
B
Boris Syomov, 2019-01-19
@kotomyava

In a bat file, you can run any external program, for example, some sed that solves such a problem remarkably, and can be found under win.
You can also write some script in python or php, or another language, and run it from bat. =)

R
res2001, 2019-01-19
@res2001

You can also use a naked batch file, without third-party tools, but with some restrictions.
But it's easier, as Boris Syomov said, to use specially designed utilities like sed for this.

A
Alejandro Esquire, 2019-01-19
@A1ejandro

You take some programming language known to you (did you probably study something at school? Not Scratch ...), for example, Pascal, write the simplest program in it that implements all your Wishlist. Moreover, the length of the program will hardly be more than 25..50 lines. You compile. You launch from a batch file. Rejoice.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question