AminetAminet
Search:
83251 packages online
About
Recent
Browse
Search
Upload
Setup
Services

text/misc/SearchReplace.lha

Mirror:Random
Showing:m68k-amigaosgeneric
No screenshot available
Short:Replace text in a file
Author:Olaf Barthel
Uploader:polluks+aminet sdf lonestar org (Stefan Haubenthal)
Type:text/misc
Architecture:m68k-amigaos >= 2.04
Date:2020-10-07
Download:http://aminet.net/text/misc/SearchReplace.lha - View contents
Readme:http://aminet.net/text/misc/SearchReplace.readme
Downloads:127
This is a small program which I cooked up to solve a problem with the
installation script of the original Roadshow demo version. That script would
insert the following line into the "S:User-Startup" file:

   If EXIST S:Network-Startup

This line is incorrect, since it should have read as follows:

   If EXISTS S:Network-Startup

Note the "EXISTS" instead of "EXIST". My problem was to safely repair this
one single line in the "S:User-Startup" file without making much of a fuss.
It turns out that some fussing is required after all...

The enclosed "SearchReplace" program will try to replace text in a file
which matches a certain pattern (case sensitive). The original file contents
can be changed "in place", meaning that after the necessary changes have been
made, the changed version will take the place of the original file (and if no
changes are indeed necessary, the original file will remain untouched).

Great care is taken so as not to delete and not to damage the original file.
Worst case, the original file will remain under a temporary name (such as
"S:User-Startup.save-1") and can be restored manually.

Full source code is provided in case you are curious, or if you want to
check for bugs. I hope that there are none.


Olaf Barthel, January 1st 2013.


Contents of text/misc/SearchReplace.lha
PERMISSION  UID  GID    PACKED    SIZE  RATIO METHOD CRC     STAMP     NAME
---------- ----------- ------- ------- ------ ---------- ------------ ----------
[generic]                 7753   12116  64.0% -lh5- f7f5 Sep 25 01:17 SearchReplace/SearchReplace
[generic]                 3651   11337  32.2% -lh5- 8de7 Jan  1  2013 SearchReplace/SearchReplace.c
[generic]                  657    1275  51.5% -lh5- 9112 Jan 14  2013 SearchReplace/SearchReplace.doc
[generic]                  406     779  52.1% -lh5- 3942 Jan  1  2013 SearchReplace/smakefile
---------- ----------- ------- ------- ------ ---------- ------------ ----------
 Total         4 files   12467   25507  48.9%            Oct  8 03:16

Aminet © 1992-2020 Urban Müller and the Aminet team. Aminet contact address: <aminetaminet net>