VideoHelp Forum
+ Reply to Thread
Results 1 to 12 of 12
Thread
  1. Hi, but pleae be patient because I'm a cat


    I need to find via batch file an example.txt file that contain

    Code:
    %use_choice%
    and replace this string so that it becomes

    Code:
    rem %use_choice%
    how can I do? thanks
    Quote Quote  
  2. I know the answer, but I'm not going to post it because you keep insisting on your "cat" stupidity. Please grow up.
    Quote Quote  
  3. I'm a Super Moderator johns0's Avatar
    Join Date
    Jun 2002
    Location
    canada
    Search Comp PM
    Open Notepad and click on edit/replace.
    Image Attached Thumbnails Click image for larger version

Name:	notepad.jpg
Views:	123
Size:	55.5 KB
ID:	48115  

    I think,therefore i am a hamster.
    Quote Quote  
  4. 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
    Quote Quote  
  5. jagabo for kindness what sed.exe are you using? can you give me that are you using?
    Quote Quote  
  6. Google sed windows
    Quote Quote  
  7. 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
    Quote Quote  
  8. Originally Posted by jagabo View Post
    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
    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%
    If I manually execute from CMD this:

    Code:
    v:\automazioneclip\system\sed\sed.exe -i "s/%use_choice%/rem %use_choice%/g" v:\AutoGen\bbb.bat
    supposing sed.exe locate in v:\automazioneclip\system\sed\ (but nothing change also if located in v:\AutoGen or other folders)

    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
    and I launch it as. bat ... it don't works

    Image
    [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
    Quote Quote  
  9. % is used by windows command line for environment variables.. jagabo will explain next post
    Last edited by teodz1984; 17th Feb 2019 at 17:17.
    Quote Quote  
  10. 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.
    Quote Quote  
  11. 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 17:18.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!