Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

bits not for bits

Performs logical negation on each bit.

Signature

> bits not {flags}

Flags

  • --signed, -s: always treat input number as a signed number
  • --number-bytes, -n {int}: the size of unsigned number in bytes, it can be 1, 2, 4, 8, auto

Input/output types:

inputoutput
intint
binarybinary
list<int>list<int>
list<binary>list<binary>

Examples

Apply logical negation to a list of numbers

> [4 3 2] | bits not
╭───┬─────╮
│ 0 │ 251 │
│ 1 │ 252 │
│ 2 │ 253 │
╰───┴─────╯

Apply logical negation to a list of numbers, treat input as 2 bytes number

> [4 3 2] | bits not --number-bytes 2
╭───┬───────╮
│ 0 │ 65531 │
│ 1 │ 65532 │
│ 2 │ 65533 │
╰───┴───────╯

Apply logical negation to a list of numbers, treat input as signed number

> [4 3 2] | bits not --signed
╭───┬────╮
│ 0 │ -5 │
│ 1 │ -4 │
│ 2 │ -3 │
╰───┴────╯

Apply logical negation to binary data

> 0x[ff 00 7f] | bits not
Length: 3 (0x3) bytes | printable whitespace ascii_other non_ascii
00000000:   00 ff 80                                             0××