Scroll to navigation

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.

Print help and exit
Print help, including hidden options, and exit
Print version and exit

OLD-TEXT matches at most once in each position, even when it matches the empty string.

specify character set encoding
whole words (OLD-TEXT matches on word boundaries only) (default=off)
rename original FILE to FILE~ before replacing (default=off)
quiet mode (default=off)
verbose mode (default=off)
simulation mode (default=off)
treat OLD-TEXT and NEW-TEXT as fixed strings, not regular expressions (default=off)
OLD-TEXT and NEW-TEXT are file names to read patterns from (default=off)
modify only files matching the given glob (may be given more than once) (default=`*')
search recursively (default=off)
prompt before modifying each file (default=off)
ignore errors when trying to preserve attributes (default=off)
keep the modification times on modified files (default=off)
search case-insensitively
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

find(1), sed(1).

October 2025 rpl 2.0.4