rrep1
Replace patterns in files.
Usage
rrep [OPTIONS]
PATTERN
REPLACEMENT
[FILE ...]
Overview
The rrep utility searches input FILEs for matches to a given PATTERN and replaces those matches by a given REPLACEMENT. The pattern is, by default, a basic regular expression. The replacement string may contain special characters to refer to portions of the matched pattern.
Binary files are, by default, ignored. A file is regarded as binary if it contains the null character.
Options
-
-E, --extended-regexp -
PATTERN is interpreted as an extended regular expression (ERE).
-
-F, --fixed-strings -
PATTERN and REPLACEMENT are interpreted as fixed strings, not as regular expressions or escape sequences.
-
-R, -r, --recursive -
Each directory that is given on the command line is processed recursively. Files and sub-directories starting with the . character are, by default, ignored.
-
--include=FILE_PATTERN -
Only files are processed that match the pattern FILE_PATTERN, except for files that are specifically given on the command line. *, ?, and [...] can be used as wildcards in FILE_PATTERN. Wildcards and backslash characters can be quoted with \.
-
--exclude=FILE_PATTERN -
Files that match the pattern FILE_PATTERN will be skipped, except for files that are specifically given on the command line (using wildcard matching as described under
--include).
-
--exclude-dir=PATTERN -
Directories that match PATTERN will be skipped, except for files that are specifically given on the command line (using wildcard matching as described under
--include).
-
-V, --version -
Print the version number of
rrep.
-SSUFFIX, --suffix=SUFFIX-
Override default backup suffix. This option implicitly activates backups.
-
-a, --all -
Files and sub-directories starting with the . character in recursively processed directories (see
--recursive) are processed as well.
-
-b -
Backup before overwriting files. The backup files are written into the directory of the original file. Equivalent to using
--backup=existing.
-
--backup[=CONTROL] -
Like
-bbut accepts a version control argument. The file name of the backup file is appended by a ~ character. The backup suffix is ~, unless set with--suffixor SIMPLE_BACKUP_SUFFIX. The version control method may be selected via the--backupoption or through the VERSION_CONTROL environment variable. Here are the values:
none,offnever make backups
(even if--backupis given)
numbered,tmake numbered backups
existing,nilnumbered if numbered backups exist, simple
otherwise
simple,neveralways make simple backups
-
--binary -
Do not ignore binary files. A file is regarded as binary if it contains the null character
\0.
-
--dry-run -
The replacement is just simulated. No file is actually modified.
-ePATTERN, --regexp=PATTERN-
Use PATTERN for matching. This option can be used to specify a pattern beginning with
-.
-
-h, --help -
Display a help message that describes the command line options and exit afterwards.
-
-i, --ignore-case -
Case distinctions in PATTERN are ignored.
-
--keep-times -
The original access and modification times of files and directories are restored after processing.
-pREPLACEMENT, --replace-with=REPLACEMENT-
Use REPLACEMENT for substitution.
-
--interactive -
Each time before a file is modified the user is prompted and can cancel the modification.
-
-q, --quiet, --silent -
All normal output messages are suppressed.
-
-s, --no-messages -
All error messages are suppressed.
-
-w, --word-regexp -
Only those matches of PATTERN are replaced that match whole words.
-
-x, --line-regexp -
Only those matches of PATTERN are replaced that match whole lines.
Exit status
Exit status is 1 if any error occurs, 0 otherwise.
Releases
7 releases since Debian 7 (Wheezy); the text changed 3 times.