nushell/docs/commands/count.md
Waldir Pimenta 5ca9e12b7f
Fix whitespace and typos (#1481)
* Remove EOL whitespace in files other than docs

* Break paragraphs into lines

See http://rhodesmill.org/brandon/2012/one-sentence-per-line/ for the rationale

* Fix various typos

* Remove EOL whitespace in docs/commands/*.md
2020-03-14 06:23:41 +13:00

2.3 KiB

count

This command counts the number of rows in a table.

Examples -

> ls
━━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━┯━━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━
 #  │ name                         │ type      │ readonly │ size    │ created      │ accessed     │ modified
────┼──────────────────────────────┼───────────┼──────────┼─────────┼──────────────┼──────────────┼──────────────
  0 │ Desktop                      │ Directory │          │  4.1 KB │ 2 months ago │ 2 months ago │ 2 months ago
  1 │ aur                          │ Directory │          │  4.1 KB │ 4 hours ago  │ 4 hours ago  │ 4 hours ago
...
 75 │ .emulator_console_auth_token │ File      │          │   16 B  │ 2 months ago │ 2 months ago │ 2 months ago
 76 │ bin                          │ Directory │          │  4.1 KB │ 2 months ago │ 2 months ago │ 2 months ago
━━━━┷━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━━━┷━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━┷━━━━━━━━━━━━━━━
> ls | count
━━━━━━━━━
 <value>
─────────
      77
━━━━━━━━━
> ls | get name | count
━━━━━━━━━
 <value>
─────────
      77
━━━━━━━━━
> ls | where type == File | count
━━━━━━━━━
 <value>
─────────
      29
━━━━━━━━━
> ls | where type == Directory | count
━━━━━━━━━
 <value>
─────────
      48
━━━━━━━━━
> ls | where size > 2KB | count
━━━━━━━━━
 <value>
─────────
      57
━━━━━━━━━