2020-03-18 02:22:35 +01:00
# skip-while
2020-06-23 20:21:47 +02:00
Skips rows while the condition matches.
2020-03-18 02:22:35 +01:00
## Usage
2020-06-23 20:21:47 +02:00
2020-03-18 02:22:35 +01:00
```shell
> [input-command] | skip-while <condition>
```
## Examples
2020-06-23 20:21:47 +02:00
If we open a file with a list of contacts, we get all of the contacts.
2020-03-18 02:22:35 +01:00
```shell
> open contacts.csv | sort-by "last name"
───┬────────────┬───────────┬──────────────────
# │ first name │ last name │ email
───┼────────────┼───────────┼──────────────────
0 │ John │ Abbot │ abbot@email.com
1 │ Chris │ Beasly │ beasly@email.com
2 │ Jane │ Carver │ carver@email.com
3 │ Francis │ Davis │ davis@email.com
───┴────────────┴───────────┴──────────────────
```
2020-06-23 20:21:47 +02:00
To exclude skip contacts with last names starting with 'A' or 'B', use skip-while:
2020-03-18 02:22:35 +01:00
```shell
> open contacts.csv | sort-by "last name" | skip-while "last name" < "C"
───┬────────────┬───────────┬──────────────────
# │ first name │ last name │ email
───┼────────────┼───────────┼──────────────────
0 │ Jane │ Carver │ carver@email.com
1 │ Francis │ Davis │ davis@email.com
───┴────────────┴───────────┴──────────────────
```
Note that the order of input rows matters. Once a single row does not match the condition, all following rows are included in the output, whether or not they match the condition:
2020-06-23 20:21:47 +02:00
2020-03-18 02:22:35 +01:00
```shell
> open contacts.csv | skip-while "last name" < "C"
───┬────────────┬───────────┬──────────────────
# │ first name │ last name │ email
───┼────────────┼───────────┼──────────────────
0 │ Jane │ Carver │ carver@email.com
1 │ Chris │ Beasly │ beasly@email.com
2 │ Francis │ Davis │ davis@email.com
───┴────────────┴───────────┴──────────────────
```
2020-06-23 20:21:47 +02:00
See the `where` command to filter each individual row by a condition, regardless of order.