replace-string-in-files(3)
[Home]
[Commands]
[Variables]
[Macro-Dev]
[Glossary]
NAME
SYNOPSIS
replace-string-in-files "from-pattern" "to-pattern" find-options "file-mask" ["file-mask"...] ["starting-path"]
query-replace-string-in-files "from-pattern" "to-pattern" find-options "file-mask" ["file-mask"...] ["starting-path"]
DESCRIPTION
replace-string-in-files performs a search for a from-pattern and and replaces the string with to-pattern in all files that match file-mask in the current directory (or from starting-path) using built in MicroEmacs 2009 constructs rather than relying on any external executables such as grep(1).
query-replace-string-in-files is identical to replace-string-in-files except the user is prompted to accept each potential replacement.
find-options
Defines the options that are specified on the command line, the default options may also be defined with the
find-setup(3) command invoked from the command line or from the the Tools menu. The find-options are defined as follows:
-2
List the file and directory attributes in the output (directory list sort key)
-3
List file and directory size in the output.
-4
List file and directory modified time in the output.
-a
Re-read all out of date buffers, prevents a manual prompt, equivalent of Yes to all. This is the inverse of -o
-b
-B
Do not ignore binary files.
-f
-F
Do not list/search files.
-g
File masks are regex (i.e. .*.emf)
-G
File masks are not regex (i.e. *.emf)
-i
Ignore search pattern case (case insensitive).
-I
Do not ignore search pattern case (case sensitive).
-l
Use existing buffer of loaded files.
-L
Do not use existing buffer of loaded files.
-m
Search pattern is a regular expression.
-M
Search pattern is not a regular expression.
-o
Do not re-read all out of date buffers, prevents a manual prompt, equivalent of No to all. This is the inverse of -a.
-p
-P
Starting path not specified
-r
Recurse into sub-directories
-R
Do not recurse into sub-directories
-S <size>
File size - less than or equal, the following size formats are supported:
-S <number> File size specified bytes.
-S <number>k File size specified in Kilobytes.
-s <size> File size greater than; supported size formats are the same as -S.
-T <time>
Modification time - older than, the following time formats are supported:
-T yy-mm-dd
-T yyyy-mm-dd
-T yyyy-mm-dd hh:mm:ss
-T days Offset time in days from midnight this morning, e.g. -T 0 would match all files not modified today.
-T days.hours[.minutes[.seconds]] Offset time in , e.g. -T 1.1.30 matches all files 25 hours and 30 minutes old.
Note that -T 1 is not the same as -T 1.0, except at midnight.
-t <time>
Modification time - newer than or equal, supported time formats are the same as -T.
-u
When used with -w, allows the file size limit of 100Mb to be disabled and strings are searched in files of any size.
-U
When used with -U, files are limited in size 100Mb otherwise they will not be searched.
-w <search-pattern>
File must contain a string matching the given search-pattern.
-x
-X
file-mask
The files to search for e.g. *.txt
starting-path
The directory location where the search should commence. The default is the location of the current buffer.
NOTES
- The location of the find options in the 3rd argument may seem odd, but the command is not required to have a single <options> <from> <to> <mask> interface as this becomes unwieldy.
- The default when no options are given is -XGPRDfMIbL, default options may be set via the
find-setup(3) command (sets /history/rsif-com registry entry).
- The -d option is not supported as
find(3) and error is reported if supplied.
- It may be advantageous to enable the -l option default using
find-setup(3).
- Use of -w is supported and is separate from the <from-pattern>, i.e. this option can still be used to filter the files to operate on.
- -w shares the -m and -i options, i.e if -m is used both the <from-pattern> and the <search-pattern> must be a regular expression pattern.
SEE ALSO
(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12