Search found 8 matches

by espaiz
13 Jul 2010 18:55
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 16357

Re: SET a:b=c won't work

ghostmachine4 , yeah... one liners are cool if you are coming from perl ;-) but for some reason my output was different: gawk "FNR=NR{s=$1}!/\[/{print s,$0}" template.txt words.txt one one two two three three aGerman I ran into a problem (both your script and mine), where in template.txt,...
by espaiz
10 Jul 2010 18:04
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 16357

Re: SET a:b=c won't work

Using

Code: Select all

call set new=%%old:!search!=!replace!%%

Does make my code work.. but I guess it's always better to use subroutines. Thank again!

DOS is fun ;-)
by espaiz
10 Jul 2010 15:53
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 16357

Re: SET a:b=c won't work

Yes that was frustrating, too bad it's for myself and not for a company that pay hourly haha :-) Well, that last script is perfect, exactly what I need. Thank you so much for your help eGerman! I have a question about the FOR loop that I posted in my first post. I put one FOR inside another one. Is ...
by espaiz
10 Jul 2010 08:15
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 16357

Re: SET a:b=c won't work

That works perfectly! I'm looking at your code and it is still quite hard for me to read it :) A question: Because you defined "set replace=[###]", I'm not sure how to modify the script to not work in this way. My words.txt will never contain [abc], [def], etc. It will always use the first...
by espaiz
10 Jul 2010 07:20
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 16357

Re: SET a:b=c won't work

aGerman, thanks. the words.txt file will only contain marker as the first line and 10-100 words after that. The template.txt file can a multi line, long story, e.g.: [###] little dog walked on a street and saw [###] little cats the [###] little dog started chasing the [###] little cats The idea, is ...
by espaiz
10 Jul 2010 06:38
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 16357

Re: SET a:b=c won't work

Thanks for you reply Alan. About the :: ... I use this to comment the code, and as I understand that's the right way, please let me know how to write comments in a different way. I'm a programmer, but using DOS for the first time, and I got used to comment my code for those who will view it later......
by espaiz
10 Jul 2010 03:27
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 16357

Re: SET a:b=c won't work

Sorry about that, I cut the counter part for some reason, updated first post.

Everything is working except "set new=!old:search=replace!"
by espaiz
09 Jul 2010 23:15
Forum: DOS Batch Forum
Topic: SET a:b=c won't work
Replies: 16
Views: 16357

SET a:b=c won't work

It's a search and replace script. I have a file called "words.txt" that looks like this: [###] one two three A template.txt file that looks like: example [###] The result should be : example one example two example three The idea is: the code below walks through every line inside word.txt,...