Anonymous user
Globally replace text in several files: Difference between revisions
Globally replace text in several files (view source)
Revision as of 19:31, 18 December 2020
, 3 years ago→version 1: added whitespace, used a template for the output section.
m (newLISP: fixed "works with") |
m (→version 1: added whitespace, used a template for the output section.) |
||
Line 1,181:
new= "Hello New York!" /* " new " used for replacement. */
parse arg fileList /*obtain required list of files from CL*/
do f=1 for
say '──────── file is being read: ' fn " ("f 'out of'
call linein fn,1,0 /*position the file for input. */
changes=
do rec=0 while lines(fn)\==0 /*read a file (if it exists). */
@.rec= linein(fn)
if pos(old, @.rec)==0 then iterate /*Anything to change? No, then skip. */
changes= changes + 1
@.rec= changestr(old, @.rec, new)
end /*rec*/
Line 1,206:
Some older REXXes don't have a '''changestr''' BIF, so one is included here ──► [[CHANGESTR.REX]].
<br><br>
<pre>
──────── file is being read: one.txt (1 out of 2 files).
|