need help with batch file to edit two text files
Posted: 18 Feb 2013 22:18
hi, a while back i got help here with a problem ( a batch program that looked into a text file with a list of items and then made a copy of all the items from one folder into another (renaming the file with a number so as not to overwrite duplicates) this has been extremely useful with my business and i am eternally grateful. now however i need to expand on this:
i have recently started selling another range of items, signs. i use the same batch file to help. the problem is a lot of my online customers buy multiples of the same sign however my old batch program only copys 1 items over (for example the list will have "warning sign.bmp", no matter how many i have sold two the same customer it only copys the 1 sign over thats in the list.
what i need is a batch program that looks into two text files. one text file that has a list of numbers (amounts customers have purchased) and the other that has the list of items i have sold. both will have the same number of lines.
i need the batch file to multiply (line by line) the items in the item text file by the numbers in the amounts file. for example
my items.txt file will have the list:
Item two.bmp
Item one.bmp
item two.bmp
Item three.bmp
item one.bmp
the amounts.txt text file will have (each number being the amount 'person A' has purchased of the same item)
2
1
3
3
1
i need the batch program to change the items file to show:
Item two.bmp
Item two.bmp
Item one.bmp
Item two.bmp
Item two.bmp
Item two.bmp
Item three.bmp
Item three.bmp
Item three.bmp
item one.bmp
as you can see the new list is the same as the 1st list however the items in the list (lines) have been multiplied depending on what the amounts.txt file says. if the first line of the amounts.txt file is the number '2' and the first line of the Items.txt file is 'Item One.bmp' then the batch program will duplicate the line to show another 'Item One.bmp' underneath the first
if its easier i am happy if the batch file copy's the new list into a different text file, for example a total.txt file
any help would be amazing! i will be using any batch code suggested that helps in my main batch file that contains other batch code for a few other different tasks
i have recently started selling another range of items, signs. i use the same batch file to help. the problem is a lot of my online customers buy multiples of the same sign however my old batch program only copys 1 items over (for example the list will have "warning sign.bmp", no matter how many i have sold two the same customer it only copys the 1 sign over thats in the list.
what i need is a batch program that looks into two text files. one text file that has a list of numbers (amounts customers have purchased) and the other that has the list of items i have sold. both will have the same number of lines.
i need the batch file to multiply (line by line) the items in the item text file by the numbers in the amounts file. for example
my items.txt file will have the list:
Item two.bmp
Item one.bmp
item two.bmp
Item three.bmp
item one.bmp
the amounts.txt text file will have (each number being the amount 'person A' has purchased of the same item)
2
1
3
3
1
i need the batch program to change the items file to show:
Item two.bmp
Item two.bmp
Item one.bmp
Item two.bmp
Item two.bmp
Item two.bmp
Item three.bmp
Item three.bmp
Item three.bmp
item one.bmp
as you can see the new list is the same as the 1st list however the items in the list (lines) have been multiplied depending on what the amounts.txt file says. if the first line of the amounts.txt file is the number '2' and the first line of the Items.txt file is 'Item One.bmp' then the batch program will duplicate the line to show another 'Item One.bmp' underneath the first
if its easier i am happy if the batch file copy's the new list into a different text file, for example a total.txt file
any help would be amazing! i will be using any batch code suggested that helps in my main batch file that contains other batch code for a few other different tasks