|
Answer» Hello all,
I'm making a batch file that should help me to make a Perl script, I use the Perl script to scan something, to do that I need a big WORDLIST, I have got one now but I should get it to be useable for the Perlscript. But the point is that in order to turn all the words into my Perl script, I'll have to add this in front of each word:$a4=" and this at the end of each word: "; .
Code: [Select]file1 I am on computer hope forumrun batch file, file2.txt is created Code: [Select]file2 $a1="I"; $a2="am"; $a3="om"; $a4="computer"; $a5="hope"; $a6="forum"; So that if you run the batch file, and you have file1 in the same directory as the batch file, file 2 will be made but than with the stuff I need around it. I'm not so good at batches so I'll be pleased if anybody can help me with this.
Thanks in advance.I have done something like this before with C++ Console App to condition data to be WRITTEN back to another file, but not sure how you will be able to do this in batch...Maybe someone here can show us both. The incrementing identifier of $ax="data"; array with incrementing (x) and dropping the data read for each line into this format might be too much for a batch. I know that C++ and other programming languages can strip data line by line and insert the leading $ax=" (the data to be inserted), and trailing ";
In C++ or another language you would want to also write your incrementation value ( x ) to another file in order for this counter++ to pick up at the next available increment if something that will be run again and again as more words are added to this and it builds at the EOF.Code: [Select]@echo off setlocal enabledelayedexpansion if exist file2 del file2 set /a counter=1 for /F "delims==" %%L in (file1) do ( echo $a!counter!="%%L";>>file2 set /a counter=!counter!+1 )
|