Open soon530 opened 1 year ago
不知道為啥,跑的有點久,不過還是裝好了。
% brew install jq
Running `brew update --auto-update`...
==> Downloading https://formulae.brew.sh/api/formula.jws.json
######################################################################## 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################## 100.0%
==> Auto-updated Homebrew!
Updated 2 taps (heroku/brew and homebrew/services).
You have 48 outdated formulae and 1 outdated cask installed.
You can upgrade them with brew upgrade
or list them with brew outdated.
==> Fetching dependencies for jq: oniguruma
==> Fetching oniguruma
==> Downloading https://ghcr.io/v2/homebrew/core/oniguruma/manifests/6.9.8
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/oniguruma/blobs/sha256:ce1351a948c52a2d0fb08e3c1eba5c1cd8ac22abb9c348299fb7b95a81e7a
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:ce1351a948c52a2d0fb08e3c1eba5c1cd8ac22abb9c34829
######################################################################## 100.0%
==> Fetching jq
==> Downloading https://ghcr.io/v2/homebrew/core/jq/manifests/1.6-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/jq/blobs/sha256:4622927182fbc7bf27c4b706e005fbae2700d15e69a68ef7002aed2676b8a4f7
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:4622927182fbc7bf27c4b706e005fbae2700d15e69a68ef7
######################################################################## 100.0%
==> Installing dependencies for jq: oniguruma
==> Installing jq dependency: oniguruma
==> Pouring oniguruma--6.9.8.arm64_ventura.bottle.tar.gz
🍺 /opt/homebrew/Cellar/oniguruma/6.9.8: 14 files, 1.4MB
==> Installing jq
==> Pouring jq--1.6.arm64_ventura.bottle.1.tar.gz
🍺 /opt/homebrew/Cellar/jq/1.6: 18 files, 1.2MB
==> Running `brew cleanup jq`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/vic/Library/Caches/Homebrew/dasel--2.0.2... (5.8MB)
Removing: /Users/vic/Library/Logs/Homebrew/dasel... (64B)
簡單用法。
% echo '{"name": "John Smith", "age": 35}' | jq -r '.age'
35
之前就知道了,只是工作上還用不到,這次有用到就研究看看。
csv to json https://stackoverflow.com/questions/29663187/csv-to-json-using-jq
安裝 https://formulae.brew.sh/formula/jq#default
官網教學 https://stedolan.github.io/jq/tutorial/
jq 實戰教學 https://myapollo.com.tw/zh-tw/jq-by-example/