| RPL(1) | User Commands | RPL(1) |
NAME¶
rpl - search and replace text in files
SYNOPSIS¶
rpl [OPTION...] OLD-TEXT NEW-TEXT [FILE...]
DESCRIPTION¶
Search and replace text in files.
Text matching the pattern OLD-TEXT is replaced by NEW-TEXT in each FILE. The pattern may match multiple lines.
- -h, --help
- Print help and exit
- --full-help
- Print help, including hidden options, and exit
- -V, --version
- Print version and exit
OLD-TEXT matches at most once in each position, even when it matches the empty string.
- --encoding=ENCODING
- specify character set encoding
- -w, --whole-words
- whole words (OLD-TEXT matches on word boundaries only) (default=off)
- -b, --backup
- rename original FILE to FILE~ before replacing (default=off)
- -q, --quiet
- quiet mode (default=off)
- -v, --verbose
- verbose mode (default=off)
- -s, --dry-run
- simulation mode (default=off)
- -F, --fixed-strings
- treat OLD-TEXT and NEW-TEXT as fixed strings, not regular expressions (default=off)
- --files
- OLD-TEXT and NEW-TEXT are file names to read patterns from (default=off)
- -x, --glob=GLOB
- modify only files matching the given glob (may be given more than once) (default=`*')
- -R, --recursive
- search recursively (default=off)
- -p, --prompt
- prompt before modifying each file (default=off)
- -f, --force
- ignore errors when trying to preserve attributes (default=off)
- -d, --keep-times
- keep the modification times on modified files (default=off)
- -i, --ignore-case
- search case-insensitively
- -m, --match-case
- ignore case when searching, but try to match case of replacement to case of original, either capitalized, all upper-case, or mixed
EXAMPLES¶
Replace all occurrences of the word ‘funny’ with ‘annoying’ in all files with extension .txt under the reports/ directory:
rpl --glob '*.txt' -R -w funny annoying reports
AUTHOR¶
Written by Göran Weinholt and Reuben Thomas.
COPYRIGHT¶
Copyright © 2025 Reuben Thomas <rrt@sc3d.org>
Licence GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it. There is NO
WARRANTY, to the extent permitted by law.
SEE ALSO¶
| October 2025 | rpl 2.0.4 |