Selecting columns and rows — Trusty CSV User Guide
Whole columns
The bar above the rows numbers the columns, as the line numbers number the rows, and the number of the cursor’s column lights up. Once the header row scrolls out of view, its names stay pinned under the bar. The numbers select columns whole, from the first row under the header to the last, however long the file:
- A click on a number selects its column; a drag over the numbers, every column it passes. Past either end of the bar, the file scrolls sideways.
Shift+Click``⇧Clickextends the selection to the column you click, andShift+→``⇧→andShift+←``⇧←by one column.Ctrl+Click``⌘Click(orAlt+Click``⌥Click) adds a column to the selection, or takes away one that is selected, as in a spreadsheet.Ctrl+Alt+C``⌥⌘C(Selection › Select Column) selects the cursor’s column.
With columns selected:
DelorBackspaceempties their cells, in one step ofCtrl+Z``⌘Z.Ctrl+C``⌘Ccopies their values, a row per line (several columns, separated by the file’s delimiter), andCtrl+X``⌘Xcopies them and empties the cells.Ctrl+V``⌘Vpastes down the columns, as a spreadsheet does: a line per row from the first one under the header, and a single value into every cell. With several columns, the fields of each line, separated by tabs (copied from a spreadsheet) or by the file’s delimiter, go one to a column. It is one step ofCtrl+Z``⌘Z, and copying a column and pasting it into another copies it as it is.- The operations of the Cells, Columns and Rows menus work on them, and the status bar adds them up (see Count, sum, average, minimum and maximum).
- A drag that starts on the number of a selected column moves the selected columns: see Dragging columns.
Esc, a click in the file or a move of the cursor ends the selection; typing does too, and writes where the cursor is, in the first column you clicked.
Dragging columns
To move columns, select them first, then drag one of their numbers along the bar: a line between two columns, down through the rows, shows where they will go. Over the left half of a column they go before it, over the right half, after it; where they wouldn’t move, there is no line. Let go to move them, or press Esc while dragging to leave them where they are. Past either end of the bar, the file scrolls sideways.
They move whole, header and every row, in one step of Ctrl + Z``⌘ Z, and stay selected where they land. Several columns move together, in their order, even if they weren’t next to each other. A drag from a column that isn’t selected selects columns, as always; to move a column a place at a time from the keyboard, Alt + ←``⌃ ⌥ ← and Alt + →``⌃ ⌥ → (see Columns).
A cursor on every value
Ctrl + Alt + Shift + C``⌥ ⇧ ⌘ C (Selection › Add Cursors to Column) selects the value of the cursor’s column in every row, header excluded, each with its own cursor. Type to replace them all, use Home or End to go to the start or end of every value and add something there, or copy the column.
people.csv
9
1
2
3
4
5
6
7
8
id,name,city,country
1,Ada Lovelace,London,United Kingdom
2,Grace Hopper,New York,United States
3,Alan Turing,Manchester,United Kingdom
4,Katherine Johnson,Hampton,United States
5,Hedy Lamarr,Vienna,Austria
6,Margaret Hamilton,Boston,United States
id,name,city,country
6 selections
Ctrl Alt Shift C
It selects up to 10,000 values; in a longer file, the first 10,000. For changes to every value of a long column, the Cells menu has no limit.
A box
Alt + Shift + Drag``⌥ ⇧ Drag selects a box: the same columns, on screen, in every row it goes over, as if the file were a grid. It follows the columns as they are drawn, aligned, not the characters of each line. A box can go over up to 10,000 rows; lines inside a value with line breaks are left out.
Column Selection Mode
When you mostly work down columns, turn on Selection › Column Selection Mode, or click Columns after Select by in the status bar ( Rows turns it off again). In this mode:
- A drag down the file selects, in each row, from where the drag started to where the pointer is: a box, without holding any key.
- Within a single row, a drag selects as usual.
Shift+Click``⇧Clickselects a box from the cursor to where you click.Shift+↓``⇧↓andShift+↑``⇧↑make the box a row longer or shorter.- A triple click selects the column you click in, whole, as a click on its number does, instead of the row.
Double clicks, Ctrl + Click``⌘ Click and the other keys work as always. The mode stays on until you turn it off, also the next time you open the editor.
Whole rows
The line numbers select rows, as in a spreadsheet:
- A click on a number selects its row; a drag over the numbers, every row it passes.
Shift+Click``⇧Clickextends the selection to the row you click.Ctrl+Click``⌘ClickorAlt+Click``⌥Clickadds a row to the selection.
A row is selected with its line break, and whole even when it spans several lines, so that copying it pastes rows, and Del removes them. To move them up and down, see Moving, copying and deleting rows.
Everything
Ctrl + A``⌘ A selects the whole file, and so does a click on the corner above the line numbers, at the left of the column bar, as in a spreadsheet. For the cleaning operations, that is how you say “every column”: see How data operations work.