Batch file reads in text file and replaces quotes with variables into new file?

Posted by John on Super User See other posts from Super User or by John
Published on 2012-05-31T03:49:53Z Indexed on 2012/05/31 4:43 UTC
Read the original article Hit count: 452

Filed under:
|
|

I have customer Pizza lists that i have saved into 5 seperate txt files from my database in this format:

Filename = 25Percent.TXT

"555-1211"

"555-1212"

"555-1223"

... ect

Each list is a phone number in quotes and each list varies in length.

Part 1:

I have two sets of variables that i would like to replace with each quote in the 5 text files.

The two variables would be like:

Var A = < Discount Pizza price for phone number is "

Var B = " 25 % >

So i would like to run a batch file that reads each line in the text file and writes into another text file the following, replacing the quotes with the variables:

New Filename = 25Percentfinished.TXT

< Discount Pizza price for phone number is "555-1211" 25 % >

< Discount Pizza price for phone number is "555-1212" 25 % >

< Discount Pizza price for phone number is "555-1223" 25 % >

Then I would repeat for 30percent.txt, then 35percent.txt, 40percent.txt, and then finally 50percent.txt file.

Part II:

I would also like to append the 5 new files together, with the append command?

I am assuming that the SET Var command would also be used?

Not sure what to do here.

© Super User or respective owner

Related posts about batch

Related posts about variables