Hello..
I've been wondering if i can change one line (or at most a few lines) from a file, without changing the rest of the lines in the file. Is it possible to carry this out using a batch file, and how to do that? Thanx in advance..
Can you put up a little sample showing what is to be changed?
In general, no, Dos Batch and NT commands do not let you find lines in a file and change them leaving the rest alone.
If you had and area that was going to be changed you could flag the start of the area and the end and then write a very sinple program to change them, any BASIC, C/++, Delphi, ForTran or even COBOL (smile).
There also is the River which does that, but I cannot plug. Offline: j@roninsg.com
Thanx for the info.. Actually, the file that I wanted to change has a few lines that often changes. So, I want to be able to change those lines without the users having to open the file and change it for themselves. Part of the original file is like this..
XXXXXXXX and AAAAAAAA is the part where I want to make the change.
I used SED to find and replace the original sequence with a user input. However, since XXXXXXXX is always changing, I think I need to use wildcard characters to make the substitution. But so far, nothing happened. Maybe u guys could take a look at it.
This is what I wrote :
SED "/DEFINE_LOCAL_CP/s/(PPNET89.*)/PPNET89.%2%/g" FBSSCFG.ndf >> TEMP.TXT
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.