Author Topic: replace the string inside file  (Read 6411 times)

causative

  • Junior Member
  • **
  • Posts: 10
    • View Profile
replace the string inside file
« on: September 12, 2014, 13:09:06 »
Is it possible in MC to replace the string in file without opening it ( manualy we open the file, press  ctrl + h and replace the string "aaa" to "bbb" )
I would like to use it in many files at the same time.

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4283
    • View Profile
    • Multi Commander
Re: replace the string inside file
« Reply #1 on: September 12, 2014, 16:09:54 »
From Script it is possible

Code: [Select]
@var $text = LoadStringFromFile( "R:\\file.txt" );
$text = StrReplace($text, "hulk" , "thor");
SaveStringToFile("R:\\file.txt", $text, 0);

And you can expand the script to so it asks for what it should find and replace it with..

causative

  • Junior Member
  • **
  • Posts: 10
    • View Profile
Re: replace the string inside file
« Reply #2 on: September 12, 2014, 16:57:44 »
thx