it2 text replace
Replace text in session buffer
Synopsis
it2 text replace <session-id> <pattern> <replacement> [flags]
Description
Replace text patterns in the session buffer.
Note: This command injects replacement text at found locations.
Use with caution as it modifies the actual terminal content.
Options
-
--case-sensitive - Case sensitive search
-
--confirm (default true) - Confirm each replacement
-
--format(default "table") - Output format (table|json|yaml|text)
-
--max-replacements(default 10) - Maximum number of replacements to make
-
--regex - Treat pattern as regular expression
-
--timeout(default "5s") - Command timeout
-
--url(default "ws://localhost:1912") - iTerm2 WebSocket URL
-
--whole-word - Match whole words only
See Also
- it2 text - Text and buffer operations in iTerm2
Examples
# Replace text in buffer
$ it2 text replace abc123 "old_value" "new_value"
# Case-sensitive replacement
$ it2 text replace --case-sensitive abc123 "error" "ERROR"
# Replace with regex
$ it2 text replace --regex abc123 "foo\d+" "bar"
# Whole word replacement
$ it2 text replace --whole-word abc123 "test" "prod"
# Limit replacements
$ it2 text replace --max-replacements 5 abc123 "x" "y"
# Replace without confirmation
$ it2 text replace --confirm=false abc123 "old" "new"