NOTE: We are redesigning our site, and this page isn't finished yet.
  Click on the Significato Journal page to see the new design.


Top Page
of Site
Top Page
of Journal
Column
Syndication
Public
Speaking
Abstinence Curriculum Free
Software
Contact
Us

Search and Replace

Updated June 24, 2002
Current Version: 1.4 ~ Updated October 27, 2001 ~ What's New

| PageMod | MySQL Backup | FutureSQL | WCN:Talk (formerly FutureForum) |
| Search and Replace | Selected Backup | Simple Form |


[ Visit our Open Source Software page or one of the links above to obtain other Open Source programs ]

Open Source Support Forum: If you need technical help, you may also leave a post at our Open Source Support Forum. If others answer questions before I get to them, I don't mind at all :-)

Register your email to receive notification about updates and additions to our Open Source software!

Search and Replace (ok, it's not an original name...) replaces characters in recursive directories and files line by line, with a strong suite of options for prompted replaces. It's a medium size utility written in Perl. It's very useful for replacing things like domain names, etc. On one client's system it processed 13,029 files, with 7,487 replaces, in 11 seconds. It also writes its operation output to a log file, so you can check what it did.

I also use it to replace items in large data sets that have been saved in text format. It's quite fast. It processed 13,402,165 replaces, (13.4 million) (a 67 meg text file with 163,441 lines) in 1 minute, 10 seconds on a Pentium 166 with 64 megs of RAM.

As an alternate method, I recommend using VEDIT, the fastest huge file text editor in the world, at 'vedit.com'.

I think VEDIT is the FASTEST Text Editor in the WORLD!!! 2 MILLION replaces in a 100 meg file in 1.51 minutes!!! I do a lot of heavy duty database manipulation, on gigantic files. When you have to WAIT and WAIT and WAIT (yawn) for other editors to decide to even begin to do the million or so replaces that you need to do, then you begin to say to yourself, "Oh, if I only had VEDIT!!!!" :-) (It's true.) Smart programmers have more than one editor in their toolbox, so they can do each, very different job, with the best tool for the job. BUY this editor today if you need speed. You won't regret it.

(I fixed a 50 meg file with 170,000 replaces multiple times using VEDIT. If I had not had VEDIT I would have been REALLY miserable. VEDIT saved my NECK.)


Now back to Search & Replace :-)

From Search & Replace v1.4, it includes the ability to use user-specified setup files -- so an administrator can copy the main file to /usr/local/bin and give each user the ability to use the script with their own setup variables, and file extensions. File extension options now provide the ability to 'include or exclude' files with a set of extensions, or ignore extensions altogether. The command line options still work, of course.

[ Note to Programmers: If you're a programmer, and are concerned about issues such as 'use strict', 'my' and other programming constructs, you may be interested in a note about programming methods. ]

Current Version

Previous Versions

What's New & Change Log

- v1.4 - October 27, 2001
        . moved 'values in text file' to external include file,
          to allow multiple users to use that feature.
          The thought behind specifying variables in an include file
          was that complicated regexes might be easier in a file,
          rather than on the command line.
        . created a variable for the default include file name.
        . modified the parameter for a user specified include file name
        . removed the -h parameter for HELP
        . changed -u (for 'values in text file') to -d
        . Now, -d pulls in the default include file name, or
               <filename> (one parameter) pulls in a user specified file
          
        . added input parameters to deal with file extensions
          -include, -exclude, -ignore [default= -include]
          => include means 'include files with these extensions'
          => exclude means 'exclude files with these extensions'
          => ignore  means 'ignore the extension and process all 
             files'
          -FILENAME [default= -none (use internal extension
           array if no file)]

        . modified the help and prompt screens

- v1.3 - May 9, 2001
        . added output of actual replaces to 'sr.replaces.log'
        . changed the formal name to 'Search and Replace'
        . changed the file name to 'srep.cgi' (for stability)

- v1.2 - May 6, 2001
        . Initial Public Release.
        . Changed to line method of parsing.
        . Added prompts, recursive directories, logs, 
          essentially a complete rewrite.

- v1.0 - May 20, 1998
        . Initial release. Used 'chunk' method of parsing text, 
          instead of lines
        . Only operated on one file at a time

Return to Top Open Source Page

 

Click to view WCP's
Resource Catalogue
We invite you to exchange Links with us; for we all benefit from more traffic.
WCP does not have any control over the content of the Google Ads below, and does not necessarily endorse each ad.

Register
your email

for update notification
to the World Community Journal pages!
About WCN & Contact Us
Affiliated
Projects
The FutureWorld
Association
Replace
Property Tax
Campaign
Hawk
Mountain
Films
Do you need a
Public Speaker?
"Peter Brown did an excellent job with the keynote speech. This man is not only capable of speaking to a national audience but he has 'world-class' ability in public speaking ."
Senator Larry Pressler, former US Senator from South Dakota
Click here for information
about booking him as a speaker at your event!



Click on the PayPal buttons above to pay for WCN products or services with a Major Credit Card!