# pseudo

> [Pseudonymise](https://en.wikipedia.org/wiki/Pseudonymization) the value of the given column by replacing them with an incremental identifier.

**[Table of Contents](TableOfContents.md)** | **Source: [src/cmd/pseudo.rs](https://github.com/dathere/qsv/blob/master/src/cmd/pseudo.rs)** | [🔣](TableOfContents.md#legend "requires UTF-8 encoded input.")[👆](TableOfContents.md#legend "has powerful column selector support. See `select` for syntax.")

<a name="nav"></a>
[Description](#description) | [Usage](#usage) | [Arguments](#arguments) | [Common Options](#common-options)

<a name="description"></a>

## Description [↩](#nav)

Pseudonymise the value of a given column by replacing it with an
incremental identifier. See <https://en.wikipedia.org/wiki/Pseudonymization>

Once a value is pseudonymised, it will always be replaced with the same
identifier. This means that the same value will always be replaced with
the same identifier, even if it appears in different rows.

The incremental identifier is generated by using the given format string
and the starting number and increment.

EXAMPLE:  

Pseudonymise the value of the "Name" column by replacing it with an
incremental identifier starting at 1000 and incrementing by 5:  

```console
$ qsv pseudo Name --start 1000 --increment 5 --fmtstr "ID-{}" data.csv
```


If run on the following CSV data:  

```csv
Name,Color
Mary,yellow
John,blue
Mary,purple
Sue,orange
John,magenta
Mary,cyan
```


will replace the value of the "Name" column with the following values:  

```csv
Name,Color
ID-1000,yellow
ID-1005,blue
ID-1000,purple
ID-1010,orange
ID-1005,magenta
ID-1000,cyan
```


For more examples, see <https://github.com/dathere/qsv/blob/master/tests/test_pseudo.rs>.
See also <https://github.com/dathere/qsv/wiki/Transform-and-Reshape#pseudo>


<a name="usage"></a>

## Usage [↩](#nav)

```console
qsv pseudo [options] <column> [<input>]
qsv pseudo --help
```

<a name="arguments"></a>

## Arguments [↩](#nav)

| &nbsp;Argument&nbsp; | Description |
|----------|-------------|
| &nbsp;`<column>`&nbsp; | The column to pseudonymise. You can use the `--select` option to select the column by name or index. See `select` command for more details. |
| &nbsp;`<input>`&nbsp; | The CSV file to read from. If not specified, then the input will be read from stdin. |

<a name="common-options"></a>

## Common Options [↩](#nav)

| &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Option&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; | Type | Description | Default |
|--------|------|-------------|--------|
| &nbsp;`‑h,`<br>`‑‑help`&nbsp; | flag | Display this message |  |
| &nbsp;`‑‑start`&nbsp; | integer | The starting number for the incremental identifier. | `0` |
| &nbsp;`‑‑increment`&nbsp; | integer | The increment for the incremental identifier. Must be greater than 0. | `1` |
| &nbsp;`‑‑formatstr`&nbsp; | string | The format string for the incremental identifier. The format string must contain a single "{}" which will be replaced with the incremental identifier. | `{}` |
| &nbsp;`‑o,`<br>`‑‑output`&nbsp; | string | Write output to <file> instead of stdout. |  |
| &nbsp;`‑n,`<br>`‑‑no‑headers`&nbsp; | flag | When set, the first row will not be interpreted as headers. |  |
| &nbsp;`‑d,`<br>`‑‑delimiter`&nbsp; | string | The field delimiter for reading CSV data. Must be a single character. (default: ,) |  |

---
**Source:** [`src/cmd/pseudo.rs`](https://github.com/dathere/qsv/blob/master/src/cmd/pseudo.rs)
| **[Table of Contents](TableOfContents.md)** | **[README](../../README.md)**
