1.

Solve : Copy a row from file to file?

Answer»

I NEED to copy only one row from a text file to another.
for example, the first text file CALLED "1' contains:
A=1
B=2
C=3

the second text file called "2' contains:
D=4

I need to add the "D=4" to the file called "1" so after the change it will looks like this:
A=1
B=2
C=3
D=4

ThanksHello again,
Please help me with my problem.

I have 2 text files with bunch of parameters and I want to copy only 1 parameter from one text file to the second using a batch file.
Can it be done? if yes, how? what is the code I need to use?

To be more specific, The main file is INI file contain about 400 parameters and the second file will contain only new parameters that I want automatically updated the main file.

Someone? Thanks in advance for your help
Avi
Hi AviT,

have you tried:

copy 1.txt+2.txt 1.txt

which should append content of file 2.txt to 1.txt .

cheers,
jamaThank you very much JAMA,
This is what I need!

Now I get hungry   , Is there an option to import only one line (from INI file that contain lots of parameters) and import this line to a different INI (Which also contain lots of parameters)

Thanks again.
AviHi again Avit,

oops, you asked for a batch.
Edit a batch MERGE.BAT containing only this one line:

copy %1+%2 %1

and call it with (assuming that the filenames are "1" and "2"):

merge 1 2        

Hope this helps,
jamaHi again Avit,

oops, you asked for a batch.
Edit a batch MERGE.BAT containing only this one line:

copy %1+%2 %1

and call it with (assuming that the filenames are "1" and "2"):

merge 1 2        

Hope this helps,
jamaThanks Jama,
Your help is great !

Did you know if it possible to import only one line from INI file that contain lots of parameters and import only this line to a different INI file (Which also contain lots of parameters).

Thanks again
AviThat's a lot harder! Since I'm no real batch expert and if you really want to do this with a batch, I recommend to download  
Timo Salmi's TSBAT.ZIP (google for it). It contains a large collection of batch TRICKS together with readable Howto-descriptions.
Sorry that I can't solve this with a snap of my fingers.

Cheers,
jama Quote

That's a lot harder!

I agree. I have QBasic on my computer, so the following works

1) Create a QBasic program (I NAMED mine z.bas)
Code: [Select]CONST File1 = "z1.txt"' This is the file w/many lines
CONST File2 = "z2.txt"' This is the file you want to add one to.
OPEN File1 FOR INPUT AS #1
LINE INPUT #1, l$
CLOSE
OPEN File2 FOR APPEND AS #2
PRINT #2, l$
CLOSE
SYSTEM
Call it in a batch file like this
qbasic /run z

Mac



Discussion

No Comment Found