Created
September 1, 2022 22:42
-
-
Save zouppen/1b9f25c2237da3ad0a0c6a3209068d19 to your computer and use it in GitHub Desktop.
A compact example how to convert rows to JSON objects in shell & jq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -eu | |
export ydin=`uname -r` | |
export os=`uname` | |
lspci | jq -Rs '{os: env.os, ver: env.ydin, laitteet: split("\n") | map(capture("^[^ ]* (?<key>[^:]*): (?<value>.*)$") ) | from_entries}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment