mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
added get-column
This commit is contained in:
parent
e2728946a0
commit
2b9b71f62d
1 changed files with 23 additions and 4 deletions
|
@ -1,7 +1,26 @@
|
|||
# This is a wrapper to get a row
|
||||
# Documentation for get-col
|
||||
# Written on 2021-03-28 06:58:50 by andras_io on discord
|
||||
def get-col [
|
||||
col_name:any # A 0 indexed row
|
||||
col_index:int # A 0 indexed col_index
|
||||
] {
|
||||
|
||||
get $col_name
|
||||
}
|
||||
# meant to be used like `ls | get-col 1`
|
||||
# ls | select $(ls | get | nth 2)
|
||||
|
||||
each {
|
||||
echo $it | select $(echo $it | get | nth $col_index)
|
||||
}
|
||||
}
|
||||
|
||||
# Documentation for get-col2
|
||||
# Written on 2021-03-28 07:00:24 by johng on discord
|
||||
def get-column [
|
||||
col_index:int # A 0 indexed col_index
|
||||
] {
|
||||
|
||||
# meant to be used like `ls | get-column 1`
|
||||
pivot | nth $col_index | pivot | get Column1 | skip
|
||||
}
|
||||
|
||||
# another working example is
|
||||
# ls | keep 2 | drop column 3
|
Loading…
Add table
Add a link
Reference in a new issue