Filtering and editing a filtered output

Say I’m editing a file containing some words “foo”. I want to edit lines containing such instances, but instead of /foo then n,n,n..., is it possible to grep out all lines “foo” and replace the current buffer with those lines (without overriding the original file). This essentially creates a “filtered view”, which is often used in spreadsheet programs to focus on specific entries.

The other part of my question is mapping back the edits I made in the “filtered view” to the original file.

There are many other use cases, especially when editing .tsv or csv files.

1 Like

The command you need is

:vg/foo/d