background image

World Community Press
 
  Public Speaking
 
Home » Open Source
   
Normal Version Print Version
Share |
     Subscribe to RSS
   

Search and Replace v1.4

October 27, 2001

Note to our Open Source users: if you haven't taken a look at the Significato Journal, we invite you to do so!

[ Visit our Open Source Software page to obtain other Open Source programs ]

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.

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
Home » Open Source
Programming