2021-03-13 22:46:40 +01:00
|
|
|
# length
|
2019-11-10 09:42:59 +01:00
|
|
|
|
2020-08-15 07:36:15 +02:00
|
|
|
Obtain the row or column count of a table.
|
|
|
|
|
|
|
|
## Flags
|
|
|
|
|
|
|
|
* `-c`, `--column`: Calculate number of columns in table
|
2019-11-10 09:42:59 +01:00
|
|
|
|
2020-06-23 20:21:47 +02:00
|
|
|
## Examples
|
2019-11-10 09:42:59 +01:00
|
|
|
|
|
|
|
```shell
|
|
|
|
> ls
|
2020-06-23 20:21:47 +02:00
|
|
|
────┬────────────────────┬──────┬──────────┬──────────────
|
|
|
|
# │ name │ type │ size │ modified
|
|
|
|
────┼────────────────────┼──────┼──────────┼──────────────
|
|
|
|
0 │ CODE_OF_CONDUCT.md │ File │ 3.4 KB │ 42 mins ago
|
|
|
|
1 │ CONTRIBUTING.md │ File │ 1.3 KB │ 42 mins ago
|
|
|
|
2 │ Cargo.lock │ File │ 113.3 KB │ 42 mins ago
|
|
|
|
3 │ Cargo.toml │ File │ 4.6 KB │ 42 mins ago
|
|
|
|
4 │ LICENSE │ File │ 1.1 KB │ 3 months ago
|
|
|
|
5 │ Makefile.toml │ File │ 449 B │ 5 months ago
|
|
|
|
6 │ README.md │ File │ 15.9 KB │ 31 mins ago
|
|
|
|
7 │ TODO.md │ File │ 0 B │ 42 mins ago
|
|
|
|
8 │ assets │ Dir │ 128 B │ 5 months ago
|
|
|
|
9 │ build.rs │ File │ 78 B │ 4 months ago
|
|
|
|
10 │ crates │ Dir │ 704 B │ 42 mins ago
|
|
|
|
11 │ debian │ Dir │ 352 B │ 5 months ago
|
|
|
|
12 │ docker │ Dir │ 288 B │ 3 months ago
|
|
|
|
13 │ docs │ Dir │ 192 B │ 42 mins ago
|
|
|
|
14 │ features.toml │ File │ 632 B │ 4 months ago
|
|
|
|
15 │ images │ Dir │ 160 B │ 5 months ago
|
|
|
|
16 │ rustfmt.toml │ File │ 16 B │ 5 months ago
|
|
|
|
17 │ src │ Dir │ 128 B │ 1 day ago
|
|
|
|
18 │ target │ Dir │ 160 B │ 5 days ago
|
|
|
|
19 │ tests │ Dir │ 192 B │ 3 months ago
|
|
|
|
────┴────────────────────┴──────┴──────────┴──────────────
|
|
|
|
```
|
|
|
|
|
2021-03-13 22:46:40 +01:00
|
|
|
By default, `length` will return the number of rows in a table
|
2020-08-15 07:36:15 +02:00
|
|
|
|
2020-06-23 20:21:47 +02:00
|
|
|
```shell
|
2021-03-13 22:46:40 +01:00
|
|
|
> ls | length
|
2020-06-23 20:21:47 +02:00
|
|
|
20
|
|
|
|
```
|
|
|
|
|
2020-08-15 07:36:15 +02:00
|
|
|
The `-c` flag will produce a count of the columns in the table
|
|
|
|
|
2020-06-23 20:21:47 +02:00
|
|
|
```shell
|
2021-03-13 22:46:40 +01:00
|
|
|
> ls | length -c
|
2020-08-15 07:36:15 +02:00
|
|
|
4
|
2020-06-23 20:21:47 +02:00
|
|
|
```
|
|
|
|
|
|
|
|
```shell
|
2021-03-13 22:46:40 +01:00
|
|
|
> ls | where type == File | length
|
2020-06-23 20:21:47 +02:00
|
|
|
11
|
|
|
|
```
|
|
|
|
|
|
|
|
```shell
|
2021-03-13 22:46:40 +01:00
|
|
|
> ls | where type == Dir | length
|
2020-06-23 20:21:47 +02:00
|
|
|
9
|
|
|
|
```
|
|
|
|
|
|
|
|
```shell
|
2021-03-13 22:46:40 +01:00
|
|
|
> ls | where size > 2KB | length
|
2020-06-23 20:21:47 +02:00
|
|
|
4
|
2019-11-10 09:42:59 +01:00
|
|
|
```
|