1
Fork 0
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:
Darren Schroeder 2021-03-28 07:23:37 -05:00
parent e2728946a0
commit 2b9b71f62d

View file

@ -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