Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 33
    How is the sed suggestion better? This seems to be the most simple answer of them all and requires installing nothing. Commented Jan 20, 2012 at 20:18
  • 5
    Can any sort of pattern matching be done here? Wildcards, Regex etc? Commented Apr 19, 2012 at 21:51
  • 33
    "How is the sed suggestion better?" - sed and similar utilities operate on files; this snippet omits the important step of reading lines from the input file and writing to the output file, while ensuring that any special characters in the file are handled correctly. Commented Jun 13, 2013 at 11:25
  • 9
    @Asad, yes that's true, the OP was asking about files, but in fact it works with streams which don't have to be files. But my point here is that this answer is flawed, since it omits reading/writing from a stream and handling any special characters. Commented Feb 15, 2014 at 8:57
  • 4
    @Bill how to use variable as a replacing text? ie. I have value in a variable and a string which has some delimter. set str=%str:"##"=%varValue%% doesn't work. Any workarounds? Commented Apr 4, 2014 at 10:32