Skip to main content

Row Selection

Row selection is the foundation of all bulk operations in VisiData: delete, export, aggregate, and filter. Selected rows appear highlighted in yellow and serve as the target for g-prefixed commands.

Learning Focus

Master the four selection methods — single row, regex, Python expression, and value match. See Filtering for opening filtered sheets from selections.

Sample Data

hostname role status region score
web01 webserver active sg 90
web02 webserver standby sg 70
db01 database active kl 85
cache01 cache active sg 60
monitor01 monitoring standby jk 50

Basic Selection

KeyAction
sSelect current row
uUnselect current row
tToggle selection of current row
gsSelect all rows
guUnselect all rows
gtToggle selection of all rows
{Jump to previous selected row
}Jump to next selected row
# Move cursor to web01 row
s # web01 is now selected (yellow)

Regex Select in Current Column (|)

Press | to select all rows where the current column matches a regex pattern.

# Move to 'status' column, cursor on 'active'
|
# Enter: active

Result — all active rows selected:

▶ web01 webserver active sg 90 ← selected
web02 webserver standby sg 70
▶ db01 database active kl 85 ← selected
▶ cache01 cache active sg 60 ← selected
monitor01 monitoring standby jk 50

Use \ (backslash) to unselect rows matching a value:

# Move to 'status' column, cursor on 'standby'
\
# Enter: standby
# Standby rows are now unselected

Regex Select in Any Column (g|)

Apply the regex to every visible column — useful when you don't know which column the value is in.

g|
# Enter: sg
# Selects any row where ANY column contains 'sg'

Use g\ to unselect rows matching regex in any column.

Python Expression Select (z|)

Press z| to select rows matching a Python condition using column names as variables.

z|
# Enter: score >= 80

Result — only rows where score is 80 or above:

▶ web01 webserver active sg 90 ← selected
web02 webserver standby sg 70
▶ db01 database active kl 85 ← selected
cache01 cache active sg 60
monitor01 monitoring standby jk 50

Multiple conditions:

z|
# Enter: region == "sg" and score >= 80

Text contains:

z|
# Enter: "web" in hostname
# Selects web01, web02

Use z\ to unselect rows matching a Python expression.

For expression syntax details, see Filtering and Selection.

In-Place Alternative — fx

Space fx Enter filters rows in-place using the same Python expressions as z|, but hides non-matching rows directly instead of marking them. No need to press " afterwards. Restore the previous row view with Space fclear Enter. See Filtering.

Value Match Select (Comma Keys)

The comma (,) key selects rows based on the current cell's value — without typing anything.

KeyCompares againstScope
,Display value of current cellCurrent column only
g,All visible columns of current rowAll visible columns
z,Typed/stored value (not formatted display)Current column only
# Move cursor to a cell containing 'sg'
,
# All rows where region = 'sg' are selected instantly

# Use z, when display and stored values differ (currency, dates)

Quick Reference

KeyAction
sSelect current row
uUnselect current row
tToggle selection
gs / gu / gtSelect / unselect / toggle all
|Select rows matching regex in current column
\\Unselect rows matching regex
g|Select rows matching regex in any column
g\\Unselect rows matching regex in any column
z|Select rows matching Python expression
z\\Unselect rows matching Python expression
,Select rows matching current cell value
g,Select rows matching current row in all columns
z,Select rows matching stored cell value
{ / }Jump to previous / next selected row
SpacefkEnterFilter in-place by keyword (custom, see Filtering)
SpacefxEnterFilter in-place by Python expression (custom, see Filtering)
SpacefclearEnterRestore previous in-place filter view

What's Next