From 84482aa24dd6c3af62a2f64977e6cd22d918684f Mon Sep 17 00:00:00 2001 From: Joshua Levy Date: Mon, 27 May 2019 15:27:37 -0700 Subject: [PATCH] One-liner to show colored, normalized JSON diffs. --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 77d2444..ff73938 100755 --- a/README.md +++ b/README.md @@ -364,6 +364,11 @@ A few examples of piecing together commands: sort a b b | uniq -u > c # c is set difference a - b ``` +- Pretty-print two JSON files, normalizing their syntax, then coloring and paginating the result: +``` + diff <(jq --sort-keys . < file1.json) <(jq --sort-keys . < file2.json) | colordiff | less -R +``` + - Use `grep . *` to quickly examine the contents of all files in a directory (so each line is paired with the filename), or `head -100 *` (so each file has a heading). This can be useful for directories filled with config settings like those in `/sys`, `/proc`, `/etc`.