diff --git a/README.md b/README.md index 8b2495e..609a21f 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1624 TILs and counting..._ +_1625 TILs and counting..._ See some of the other learning resources I work on: - [Ruby Operator Lookup](https://www.visualmode.dev/ruby-operators) @@ -1556,6 +1556,7 @@ If you've learned something here, support my efforts writing daily TILs by - [Find All Files Matching A Name With fd](unix/find-all-files-matching-a-name-with-fd.md) - [Find All Files With A Specific Extension With fd](unix/find-all-files-with-a-specific-extension-with-fd.md) - [Find All Tool Version Files Containing Postgres](unix/find-all-tool-version-files-containing-postgres.md) +- [Find And Copy A Value From Large JSON Output](unix/find-and-copy-a-value-from-large-json-output.md) - [Find Any Dotfiles That Modify Path Env Var](unix/find-any-dotfiles-that-modify-path-env-var.md) - [Find A File Installed By Brew](unix/find-a-file-installed-by-brew.md) - [Find Duplicate Lines In A File](unix/find-duplicate-lines-in-a-file.md) diff --git a/unix/find-and-copy-a-value-from-large-json-output.md b/unix/find-and-copy-a-value-from-large-json-output.md new file mode 100644 index 0000000..b220240 --- /dev/null +++ b/unix/find-and-copy-a-value-from-large-json-output.md @@ -0,0 +1,22 @@ +# Find And Copy A Value From Large JSON Output + +I've been using [`fx`](https://github.com/antonmedv/fx) for years as a sidekick +to [`jq`](https://jqlang.org/) when I want to explore a JSON document or JSON +output that I'm not yet familiar with. A more recent version of `fx` added the +ability to _yank_ (copy) values and keys you find in the document. + +For instance, I may be looking for some info about my AWS RDS instances, so I +pipe that command to `fx`. + +```bash +$ aws rds describe-db-instances --output json | fx +``` + +This takes a moment to process and then the `fx` viewer is populated with a +large blob of JSON. I can then hit `/` to start a document search, type in +something like `Endpoint`, and then look around for the specific key-value pair +I'm interested in. + +I can then hit `y` to indicate that I want to copy the element under my cursor. +If it is a key-value pair I will then be prompted to pick whether I want the +value (`v`), the key (`k`), or the JSON path to this value (`p`).