How to resolve the algorithm Globally replace text in several files step by step in the Vedit macro language programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Globally replace text in several files step by step in the Vedit macro language programming language
Table of Contents
Problem Statement
Replace every occurring instance of a piece of text in a group of text files with another one.
For this task we want to replace the text "Goodbye London!" with "Hello New York!" for a list of files.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Globally replace text in several files step by step in the Vedit macro language programming language
Source code in the vedit programming language
File_Open("files.lst") // list of files to process
#20 = Reg_Free // text register for filename
While(!At_EOF) {
Reg_Copy_Block(#20, Cur_Pos, EOL_Pos)
File_Open(@(#20))
Replace("Goodbye London!", "Hello New York!", BEGIN+ALL+NOERR)
Buf_Close(NOMSG)
Line(1, ERRBREAK)
}
Reg_Empty(#20) // Cleanup
Buf_Quit(OK)
You may also check:How to resolve the algorithm Kolakoski sequence step by step in the Mathematica/Wolfram Language programming language
You may also check:How to resolve the algorithm Roman numerals/Decode step by step in the SPL programming language
You may also check:How to resolve the algorithm Stern-Brocot sequence step by step in the D programming language
You may also check:How to resolve the algorithm Thue-Morse step by step in the Quackery programming language
You may also check:How to resolve the algorithm Abbreviations, easy step by step in the Racket programming language