Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hello,
i would like to write a DOS Batch script to create a multiple files based on the values from a single file mainfile.txt (For instance, mainfile.txt has 5 values as
A200001
A200002
B200101
C200101
C200201
I need a dos batch script to create five files with below names and it values are also same
File name - Its value
A200001.txt - A200001
A200002.txt - A200002
B200101.txt - B200101
C200101.txt - C200101
C200201.txt - C200201mainfile.txt may have any values and may have any no. values. Could some one please assist me on this?
Thanks for your help

What is a file's "value"?
=====================================
If at first you don't succeed, you're about average.M2

Values --- I mean, the content of the file; File (mainfile.txt) has records as A200001
A200002
B200101
C200101
C200201
and would like to create different files based on the content of mainfile.txt

Thanks, It worked. But, actual requirement is as below... I am able to do this on Unix with the help of other person. But is someting posible in windows batch???
Here is the detail example: I have a textfile and four static parameter files (having ‘?’). mainfile.txt has below records (this count may be more than 50)
A200001
A200101
B200001
B200002
C200001
D200101
D200102
D200201And 4 static parameter files corresponding to records in mainfile.txt, started with A,B,C,D
1.audit_paramter.prm
[PQRS.temp_info]
$$Source_file_audit=?
$$Source_file_audit_dir = \\dal1mspcx55\cogent$\productionqc\?\?2.borrower_paramter.prm
[PQRS.temp_info]
$$Source_file_borrower =?
$$Source_file_borrower_dir = \\dal1mspcx55\cogent$\productionqc\?\?3.carriage_paramter.prm
[PQRS.temp_info]
$$Source_file_carriage =?
$$Source_file_carriage_dir = \\dal1mspcx55\cogent$\productionqc\?\?4.document_paramter.prm
[PQRS.temp_info]
$$Source_file_document =?
$$Source_file_document_dir = \\dal1mspcx55\cogent$\productionqc\?\?
Now I would like to create different parameter files based on the records from mainfile.txt and using static parameter filesIf records starts with A, it should create audit_paramter_*.prm such as
audit_paramter_A200001.prm
[PQRS.temp_info]
$$Source_file_audit=A200001
$$Source_file_audit_dir = \\dal1mspcx55\cogent$\productionqc\2000\A200001audit_paramter_A200101.prm
[PQRS.temp_info]
$$Source_file_audit=A200101
$$Source_file_audit_dir = \\dal1mspcx55\cogent$\productionqc\2001\A200101If records starts with b, it should create borrower_paramter_*.prm and so on.. like 8 different parameter files??? Would this possible do with sed / scripting??? Can someone please assist?
I can replace ‘?’ with other symbols to differentiate two different values or we can create new paramter values with our using exsiting (which i did in unix)
Thanks in advance

![]() |
Heart monitor
|
how to execute exe in cal...
|
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |