Identifying Columns

The following formats are avaialble for specifying which columns to manipulate.

These patterns are recognised by all commands that manipulate columns in some way.

Format In Words Description
{name} a column name

Selects a column by its name or position.

psv first attempts to match the name against the table's column names.

If no column names match and {name} is a number, then the number will be used as described for .{number} below.

This behaviour is expected be suitable for most situations.

Ambiguous column identification can be overcome via the following alternatives.

first the word first

selects the left-most column of a table.

Tip the first keyword is implied to mean before first when used as the last argument to the put, move or insert commands.

last the word last

selects the right-most column of a table.

Tip the last keyword is implied to mean after last when used as the last argument to the put, move or insert commands.

before the word before

The before keyword indicates that the next argument will be the name of a target column, before which the command's action should take place.

Specifically:

  • before must be the second-last argument for a command
  • the column named after the before keyword will be the command's target
  • use :before to address a column named before

e.g. psv put todo before done will move or insert the todo column before the done column.

after the word after

The after keyword indicates that the next argument will be the name of a target column, after which the command's action should take place.

Specifically:

  • after must be the second-last argument for a command
  • the column named after the after keyword will be the command's target
  • use :after to address a column named after

e.g. psv put todo after done will move or insert the todo column after the done column.

:{name} colon {name}

Selects a column exclusively by its name.

Even if name is a number, it will not be used as a column's position.

:first, :last, :config etc. should be used to identify columns with names that would otherwise match psv keywords.

.{number} dot {number}

selects a column exclusively by its position, starting with 1 for the left-most column.

Let's move the column "40" to the front of the table... | eight (8) | six (6) | four (4) | two (2) | first | last | 10 | 20 | 30 | 40 | Ok, 4 was not good enough, what about "40" | eight (8) | six (6) | four (4) | two (2) | first | last | 10 | 20 | 30 | 40 | ".3" will move the 3rd column... | eight (8) | six (6) | four (4) | two (2) | first | last | 10 | 20 | 30 | 40 | ":4" can be used to ensure that the number "4" will not be used as a column position - in this case, "four (4)" is chosen - embedded numeric matches have higher priority than string prefixes (i.e. "40") | eight (8) | six (6) | four (4) | two (2) | first | last | 10 | 20 | 30 | 40 | Move columns by the "most appropriate match" - "last" identifies the last column ("40") - "2" matches the left-most character in "20" - "7" identifies the 7th column, since no columns have a "7" in their names - "our" matches the "our" in "four (4)" | eight (8) | six (6) | four (4) | two (2) | first | last | 10 | 20 | 30 | 40 |