mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 02:55:07 +02:00
Add 'every' command to select (or skip) every nth row (#1992)
* Add 'every' command * Add --skip option to 'every' command This option skips instead of selects every nth row * Fix descriptions for 'every' command * Add docummentation for 'every' command * Check actual filenames in 'every' command tests
This commit is contained in:
46
docs/commands/every.md
Normal file
46
docs/commands/every.md
Normal file
@ -0,0 +1,46 @@
|
||||
# every
|
||||
|
||||
Selects every n-th row of a table, starting from the first one. With the `--skip` flag, every n-th row will be skipped, inverting the original functionality.
|
||||
|
||||
Syntax: `> [input-command] | every <stride> {flags}`
|
||||
|
||||
## Flags
|
||||
|
||||
* `--skip`, `-s`: Skip the rows that would be returned, instead of selecting them
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
```shell
|
||||
> open contacts.csv
|
||||
───┬─────────┬──────┬─────────────────
|
||||
# │ first │ last │ email
|
||||
───┼─────────┼──────┼─────────────────
|
||||
0 │ John │ Doe │ doe.1@email.com
|
||||
1 │ Jane │ Doe │ doe.2@email.com
|
||||
2 │ Chris │ Doe │ doe.3@email.com
|
||||
3 │ Francis │ Doe │ doe.4@email.com
|
||||
4 │ Stella │ Doe │ doe.5@email.com
|
||||
───┴─────────┴──────┴─────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open contacts.csv | every 2
|
||||
───┬─────────┬──────┬─────────────────
|
||||
# │ first │ last │ email
|
||||
───┼─────────┼──────┼─────────────────
|
||||
0 │ John │ Doe │ doe.1@email.com
|
||||
2 │ Chris │ Doe │ doe.3@email.com
|
||||
4 │ Stella │ Doe │ doe.5@email.com
|
||||
───┴─────────┴──────┴─────────────────
|
||||
```
|
||||
|
||||
```shell
|
||||
> open contacts.csv | every 2 --skip
|
||||
───┬─────────┬──────┬─────────────────
|
||||
# │ first │ last │ email
|
||||
───┼─────────┼──────┼─────────────────
|
||||
1 │ Jane │ Doe │ doe.2@email.com
|
||||
3 │ Francis │ Doe │ doe.4@email.com
|
||||
───┴─────────┴──────┴─────────────────
|
||||
```
|
Reference in New Issue
Block a user