Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Command Delete - [del]ete

Deletes visible lines matching pattern.

Example delete visible lines containing “debug”

rxedit sample.rs a::debug delete:debug

Details

  • delete removes lines from the output entirely (not just hiding them).
  • use less or set key / where key (sk=,wk=) to constraint the scope.

delete flags

NameFormatExampleDescription
insensitivei::icase-insentive search
afterA(\d+)::A16Show NUM lines after each match.
beforeB(\d+)::B5Show NUM lines before each match.
contextC(\d+)::C5Show NUM lines before and after each match.
fixed_stringF::Ftreat search as regular string, not a regex
use_grep_shortcodesg::gexpands shortcodes (..→.*, ~~s.→ +)
no_use_grep_shortcodesG::Gdoes not expand grep shortcodes
show_ownero::oshow “owner” of the line
set keysk=([a-z]+)(?:.|/|$)::sk=importan/ set key to a value that can be used with wk=. in later commands
where_keywk=([a-z]+)(?:.|/|$)::wk=mykey/puts an extra criteria to other commands
where_linenumwl=([-0-9A-Ca-chtHT,.]+)::wl=..5,8,-1/limit line number range

Notes about commands that modify the text

  • Nothing gets saved until you use the -O modify in place flag or the -o <some path> output flag.
  • Those commands only apply to matching visible lines, unlike say a sed insert or delete.
  • append,prepend,delete will throw off the line numbers used in where line flags
  • When modifying a source code file, the result may not be syntaxically correct, so be careful.
    • rxedit is designed on the expectation that modification commands will be used on version-controlled files.
    • but you could use the -o myfile.bak flag to save and diff your changes first.
  • Use explain to make sure all previous commands to show/hide lines went as expected.
  • Modification commands support the ::u user confirmation flag, which will prompt the user for confirmation.
    • Use of that flag will, by design, trigger an immediate error in batch mode.
  • rxedit will “follow” symlinks so it will affect the actual file if you modify it.

SEE ALSO

shortcodes, chaining, noop, flags