rsub
—
substitute lines in a file or append if not found
rsub |
[-A ] -r
line_regex -l
line_text target |
rsub |
target <
block_content |
rsub
is shipped to remote machines by
rset(1) to
provide a standard method of modifying configuration parameters within a file.
Two modes of operation are supported: line substitution and block replacement.
line replacements are defined by the flags
-r
and -l
, while the content
for a text block is provided on STDIN.
The arguments for line subsitution are as follows:
-A
- Append line if the pattern is not found.
-r
- A regular expression matching the line to replace.
-l
- The replacement text for a matching line. Newlines are not permitted as
part of the replacement string.
When updating a block of text, RSUB_START
and
RSUB_END
define the beginning and ending markers.
The rsub
utility exits with one of the following values:
0
- Target file was updated
1
- No changes were made, or an error occurred
2
- Incorrect parameters
3
- File not found