drop nth
for filters> drop nth {flags} (row number or row range) ...rest
row number or row range
: the number of the row to drop or a range to drop consecutive rows...rest
: the number of the row to dropinput | output |
---|---|
list<any> | list<any> |
Drop the first, second, and third row
> [sam,sarah,2,3,4,5] |drop nth012
╭───┬───╮
│0│3│
│1│4│
│2│5│
╰───┴───╯
Drop the first, second, and third row
> [0,1,2,3,4,5] |drop nth012
╭───┬───╮
│0│3│
│1│4│
│2│5│
╰───┴───╯
Drop rows 0 2 4
> [0,1,2,3,4,5] |drop nth024
╭───┬───╮
│0│1│
│1│3│
│2│5│
╰───┴───╯
Drop rows 2 0 4
> [0,1,2,3,4,5] |drop nth204
╭───┬───╮
│0│1│
│1│3│
│2│5│
╰───┴───╯
Drop range rows from second to fourth
> [firstsecondthirdfourthfifth] |drop nth (1..3)
╭───┬───────╮
│0│first│
│1│fifth│
╰───┴───────╯
Drop all rows except first row
> [0,1,2,3,4,5] |drop nth1..
╭───┬───╮
│0│0│
╰───┴───╯
Drop rows 3,4,5
> [0,1,2,3,4,5] |drop nth3..
╭───┬───╮
│0│0│
│1│1│
│2│2│
╰───┴───╯
Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/drop_nth.html