Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Dos Batch replace strings
Name: gnx Date: April 14, 2009 at 15:33:33 Pacific OS: Windows XP Subcategory: Batch
Comment:
Hey,,
So far I have this: @ECHO OFF setLocal EnableDelayedExpansion
set str=abcdefghijklmnopqrstuvwxyz set /a a=0 set /a max=25 :reset set ran=%random% set /a ran-=1 if %ran% gtr %max% goto reset if %ran% lss 1 goto reset set st=!str:~%ran%,3! echo %st%
set cnt= set ran=
it gets a set of 3 random characters from "str" well, kinda random^^
I have a file "media.txt" in this format: [Filename.mp3] [Filename.mp3]
and so on.. what I want to do is replace everything between [] with the random characters i generated.
Name: ghostdog Date: April 15, 2009 at 00:12:18 Pacific
Reply:
if you can use Python for Windows
import string
import random
random_letters = ''.join(random.sample(string.letters,3))
for line in open("file"):
line = line.strip()
if "[" in line:
print "[" +random_letters + "." +line[1:].split(".")[-1]
Summary: I'd like to replace string with new one in *.srt file. I found similar solution created by M2 here: http://www.computing.net/answers/pr... ---------------------------------------------------- @echo o...
Summary: Hi, Please help me on this. As part of a batch script, I need to replace (or substitute) a particular character in a string variable with another character. For example: set vara=hellohow r u need to ...