github.com/xztaityozx/sel@v1.1.10/README.md (about) 1 # sel 2 **sel**ect columns 3 4 ![Go](https://github.com/xztaityozx/sel/workflows/Go/badge.svg) 5 6 extra _cut(1)_ command with `awk`'s column selection and slice notation. 7 8 ![example](assets/example.png) 9 10 # Install 11 ## go install 12 ``` 13 $ go install github.com/xztaityozx/sel 14 ``` 15 16 ## Download binary from GitHub Releases 17 Download prebuild binary from [release page](https://github.com/xztaityozx/sel/releases) 18 19 20 ## (Optional) Shell completion script 21 Completion script is available for bash, fish, PowerShell and zsh. 22 23 ```sh 24 # example 25 # for bash 26 $ source <(sel completion bash) 27 # for fish 28 $ sel completion fish | source 29 # for PowerShell 30 $ sel completion powershell | Out-String | Invoke-Expression 31 # for zsh 32 $ sel completion zsh > ${fpath[1]}/_sel 33 ``` 34 35 # Usage 36 37 ``` 38 39 _ 40 ___ ___| | 41 / __|/ _ \ | 42 \__ \ __/ | 43 |___/\___|_| 44 45 __sel__ect column 46 47 Usage: 48 sel [queries...] 49 50 Query: 51 index select 'index' 52 start:stop select columns from 'start' to 'stop' 53 start:stop:step select columns each 'step' from 'start' to 'stop' 54 55 start:/end regexp/ select columns from 'start' to /end regexp/ 56 /start regexp/:end select columns from /start regexp/ to 'end' 57 /start regexp/:/end regexp/ select columns from /start regexp/ to /end regexp/ 58 59 Examples: 60 61 $ cat /path/to/file | sel 1 62 $ sel 1:10 -f ./file 63 $ cat /path/to/file.csv | sel -d, 1 2 3 4 -- -1 -2 -3 -4 64 $ cat /path/to/file.csv | sel --csv 1 2 3 4 65 $ sel 2:: -f ./file 66 $ cat /path/to/file | sel /^begin/:/^end/ 67 $ echo AAA BBB CCC | sel --template 'one: {} two: {} three: {}' 1 2 3 68 69 Available Commands: 70 completion Generate completion script 71 help Help about any command 72 73 Flags: 74 --csv parse input file as CSV 75 -a, --field-split shorthand for -gd '\s+' 76 -h, --help help for sel 77 -d, --input-delimiter string sets field delimiter(input) (default " ") 78 -f, --input-files strings input files 79 -D, --output-delimiter string sets field delimiter(output) (default " ") 80 -r, --remove-empty remove empty sequence 81 -S, --split-before split all column before select 82 -t, --template string template for output 83 --tsv parse input file as TSV 84 -g, --use-regexp use regular expressions for input delimiter 85 -v, --version version for sel 86 87 Use "sel [command] --help" for more information about a command. 88 89 ``` 90 91 # Features 92 - one-indexed 93 - index `0` refers to the entire line. (like `awk`) 94 - slice notation