Need help to create batch file

May 4, 2010 at 23:29:02
Specs: Windows XP
Hi All,

please help me out in creating a batch file to generate a output.txt file which will contain input from 3 different .txt files ( say A.txt , B.txt, C.txt ).
A.txt will contain a list of file numbers with .drw extension.
example for A.txt:
84313746.drw
84313749.drw
84313750.drw
84313751.drw
.
.
.
.

B.txt and C.txt will contain fixed data.

in brief my output file should be : B.txt + A.txt(only first data line from A.txt) + B.txt +A.txt(only second data line from A.txt) + B.txt +A.txt(only third data line from A.txt) +......... + C.txt

i am new to batch coding , actually i am from CAD design . i need this bach file to print bunch of drawings through Pro-Engineer design tool.

Thanks in advance


See More: Need help to create batch file

Report •


#1
May 5, 2010 at 00:48:02
It's not clear to me. If you're lucky it may be clear to someone else.


=====================================
Helping others achieve escape felicity

M2


Report •

#2
May 5, 2010 at 00:59:41
i will try to explain it ....

output txt file should be in this fashion:

Data from b.txt file
1st line from A.txt file
Data from b.txt file
2nd line from A.txt file
Data from B.txt file
3rd line fron A.txt file
.
.
.
.nth line from A.txt file
Data from C.txt file

hope i am clear now.


Report •

#3
May 5, 2010 at 08:24:48
Clear to me (M2, having bad day ;) ...

So you need a loop in which you display content of B.txt and 1 line subsequently from A.txt
To finish, adding C.txt

Something like this:
@echo off

del /Q output.txt

for /f "tokens=*" %%f in (A.txt) do (
type B.txt >> output.txt
echo %%f>> output.txt
)

type C.txt >> output.txt


Report •

Related Solutions


Ask Question