Hi,
I want to replace an expression in a file with another expression on a command line.
Example
prog.exe <string1> <string2> <filename>
Does anyone know such a tool?
Page 1 of 1
Replace string of file on command line
#2
Posted 01 September 2006 - 03:41 PM
In the UNIX world they would use a utility named "sed". Here's a port: http://gnuwin32.sour...ackages/sed.htm. It's not the easiest thing in the world to use, but it's not that hard either once you get the hang of it.
#4
Posted 02 September 2006 - 03:40 PM
Thanks,
Gsar looks more easy, but I couldn't get it to work with search strings with a comma, but that is what I need.
It doesn't work for a string containing a comma and text, like 0,win. I tried to put it in quotes, but no luck.
Then I replaced it with ASCII or Hex-Code it just displays one match, but there are much more.
Does anybody know a solution for that or another tool?
Gsar looks more easy, but I couldn't get it to work with search strings with a comma, but that is what I need.
It doesn't work for a string containing a comma and text, like 0,win. I tried to put it in quotes, but no luck.
Then I replaced it with ASCII or Hex-Code it just displays one match, but there are much more.
Does anybody know a solution for that or another tool?
#5
Posted 02 September 2006 - 04:24 PM
Yes use Munge.exe. Its part of the NT4 Resource Kit. You can search for it using google, I used it a few days ago for a batch file and it works very well.
Just create a txt file containing the current string and the required string separated by a space. You can sounded the string with " " as it works with any quoted text so your expression should work.
strings.txt contains your search strings and file.txt is the file you want to edit
Just create a txt file containing the current string and the required string separated by a space. You can sounded the string with " " as it works with any quoted text so your expression should work.
MUNGE strings.txt -l -t file.txt
strings.txt contains your search strings and file.txt is the file you want to edit
#6
Posted 03 September 2006 - 04:49 AM
Thanks At0mic,
that's the most easiest and Windows-like tool.
that's the most easiest and Windows-like tool.
Share this topic:
Page 1 of 1



Help

Back to top








