https://github.com/minoritea/select-by-key
A command that divides input into keys and values, and returns the values corresponding to the keys selected in the pipeline.
https://github.com/minoritea/select-by-key
command-line-tool go golang helper-tool utility
Last synced: 3 months ago
JSON representation
A command that divides input into keys and values, and returns the values corresponding to the keys selected in the pipeline.
- Host: GitHub
- URL: https://github.com/minoritea/select-by-key
- Owner: minoritea
- License: mit
- Created: 2021-12-10T15:36:27.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-04-09T13:30:32.000Z (about 2 years ago)
- Last Synced: 2025-01-11T08:22:37.717Z (4 months ago)
- Topics: command-line-tool, go, golang, helper-tool, utility
- Language: Go
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# select-by-key
A command that divides input into keys and values,
and returns the values corresponding to the keys selected in the pipeline.## How to install
```bash
go install github.com/minoritea/select-by-key
```## How to use
```bash
echo "key value" | select-by-key -- grep key #> value
```1. Pass delimiter-separated key-value pairs or JSON of an object to the standard input.
- If `-json` option is given, the input will be interpreted as a JSON string.
- Otherwise, the input will be divided into keys and values by the first delimiter for each lines.
- The delimiter is specified with the `-d` option and defaults to space.
2. Pass a filter command and arguments after the "--".
- The filter command must take keys and output the selected keys.
3. Then `select-by-key` will output the values corresponding to the selected keys.## License
MIT License(see LICENSE file).