Hi, but pleae be patient because I'm a cat
I need to find via batch file an example.txt file that contain
and replace this string so that it becomesCode:%use_choice%
how can I do? thanksCode:rem %use_choice%
+ Reply to Thread
Results 1 to 12 of 12
-
-
I know the answer, but I'm not going to post it because you keep insisting on your "cat" stupidity. Please grow up.
-
Open Notepad and click on edit/replace.
I think,therefore i am a hamster. -
Get a command line text editor like sed and learn to use it:
Code:sed s/"%%use_choice%%"/"rem %%use_choice%%"/ input.txt >output.txt
-
jagabo for kindness what sed.exe are you using? can you give me that are you using?
-
I've already done hundreds of attempts and I'm not able. I'm a stupid cat or not? obvious that I already tried with google
-
exactly I don't know for what reasons I cannot but if I try this but suppose a bbb.txt file locate in v:\autogen and simply containing this text:
Code:%use_choice%
Code:v:\automazioneclip\system\sed\sed.exe -i "s/%use_choice%/rem %use_choice%/g" v:\AutoGen\bbb.bat
it works (the bbb.txt file is overwrite but becomes rem %use_choice%)
But I need to work already inside a batch, so for example:
when I have a simple.bat file that contain:
Code:v:\automazioneclip\system\sed\sed.exe -i "s/%use_choice%/rem %use_choice%/g" v:\AutoGen\bbb.bat
[Attachment 48116 - Click to enlarge]
the same commandline out of a batch, strangely don't works
probably inside a batch the % % expression is referred alwais to a variable -
% is used by windows command line for environment variables.. jagabo will explain next post
Last edited by teodz1984; 17th Feb 2019 at 18:17.
-
The percent sign in a batch file has a meaning, it's not just a text character. If you want a literal percent sign you have to "escape" it, %%, just like in my earlier post.
-
Code:
v:\automazioneclip\system\sed\sed.exe -i "s/%%use_choice%%/rem %%use_choice%%/g" v:\AutoGen\bbb.bat
just use a text editor to do the replacement .https://notepad-plus-plus.org/Last edited by teodz1984; 17th Feb 2019 at 18:18.
Similar Threads
-
Find and replace only in selection, Subtitle Edit
By SUWII in forum SubtitleReplies: 6Last Post: 21st Dec 2018, 03:14 -
How to find string in a large file?
By marcorocchini in forum Newbie / General discussionsReplies: 2Last Post: 26th Oct 2016, 16:38 -
BATCH that find and replace text between [DDRAWSINC] and [
By marcorocchini in forum Newbie / General discussionsReplies: 3Last Post: 13th Sep 2016, 08:31 -
how to find "whatever" string lenght and replace
By marcorocchini in forum Newbie / General discussionsReplies: 3Last Post: 3rd Apr 2016, 14:49 -
how to find and replace (add a REM) a text string inside a txt file?
By marcorocchini in forum Newbie / General discussionsReplies: 1Last Post: 10th Nov 2015, 16:58