The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.


replace - substitutes text

Use perls regular expressions on a list of files.



replace --search 'foo' --replace 'bar' --recurse --log *


Replace is a utility to substitute text in a bunch of files. It is used also to demonstrate the use of perl module Startup. You can use perls regular expressions as search and replace strings.

usage: $PROGNAME {--option [arg]} file(s)

   search     s  search pattern
   replace    s  replace pattern
   mode       s  substitute mode (i=ignore case, g=global) default g
   log           write a logfile
   gimmick       replace pattern shall be "gimmicked"
   src_base   s  Regard this as start directory in relative mode
   dest_base  s  Store output files based at this directory
   from_stdin    Take input from stdin
   to_stdout     Write output to stdout
   filemode   s  New files get access mode s (default 0600)
   dirmode    s  New directories get access mode s (default 0700)
   overwrite     Overwrite existing files
   recurse       Operate recursively on directories
   relative      Store files relatively to destdir when in recurse mode
   suffix     s  Give output files this suffix




Martin Schwartz <>.