Menu

Replace text: use file name as replacement

Anonymous
2009-08-19
2012-11-14
  • Anonymous

    Anonymous - 2009-08-19

    How can I replace a text with the file name?

    Scenario: I have thousands of text files which are all identically except their file name. A specific part of the texts should be replaced with the name of the file.

    Thanx!

     
    • Gadrin

      Gadrin - 2009-08-20

      Sounds like a job for a scripting language like VBScript.

      VBScript can get a list of files in a folder, and loop thru them, open each file
      and replace text and re-save the file.

       
    • cchris

      cchris - 2009-08-20

      I'd use awindowless editor to do the task, sed comes to mid. And a batch file to have sed work on all files: the cript would be generated using the environment variable containing the current processed file.

      Merging sed capabilities into NP++ and adding batch processing to it looks like a dream. But why not?

      CChris

       
MongoDB Logo MongoDB