Jq

JC - JSON from CLI

how to build json from cli we all like json, do we ? https://kellyjonbrazil.github.io/jc/docs/parsers/ping add package doas pkg_add jc try ping openbsd-box # ping -c 3 1.1.1.1 |jc --ping -p 2>/dev/null { "destination_ip": "1.1.1.1", "data_bytes": 56, "pattern": null, "destination": "1.1.1.1", "packets_transmitted": 3, "packets_received": 3, "packet_loss_percent": 0.0, "duplicates": 0, "round_trip_ms_min": 9.219, "round_trip_ms_avg": 9.826, "round_trip_ms_max": 10.158, "round_trip_ms_stddev": 0.43, "responses": [ { "type": "reply", "bytes": 64, "response_ip": "1.1.1.1", "icmp_seq": 0, "ttl": 59, "time_ms": 10.

HTMLQ

stumpled upon some thing cool, htmlq! It’s like jq, but for HTML. Installation Rust htmlq need rust. so, let’s install rust first. doas pkg_add rust Add Link to Path cat << 'EOF' |doas tee -a /etc/profile # Rust/Cargo export PATH=$PATH:/root/.cargo/bin EOF . /etc/profile Install HTMLQ doas cargo install htmlq some Examples Extract Links curl -s https://www.openbsd.org | htmlq --attribute href a |head Example user@nixbox$ curl -s https://www.openbsd.org | htmlq --attribute href a |head goals.

Jq

Json Query some basics about JQ https://stedolan.github.io/jq https://www.baeldung.com/linux/jq-command-json RAW Data cat history.shelly.0.SHEM-3#40F52000B661#1.Total.Current.json | jq '.[0:3]' [ { "val": 2.64, "ack": 1, "ts": 1607900404883, "q": 0, "user": "system.user.admin" }, { "val": 2.61, "ack": 1, "ts": 1607900410483, "q": 0, "user": "system.user.admin" }, { "val": 2.58, "ack": 1, "ts": 1607900416083, "q": 0, "user": "system.user.admin" } ] Query First Record cat history.shelly.0.SHEM-3#40F52000B661#1.Total.Current.json | jq '.[0]' { "val": 2.64, "ack": 1, "ts": 1607900404883, "q": 0, "user": "system.