@@ -9,7 +9,7 @@ As an exercise, let's try to mimick some of the examples from the [jq tutorial](
99
1010Get the last 5 commits from the gron repo:
1111```
12- ▶ gron ' https://api.github.com/repos/tomnomnom/gron/commits?per_page=5'
12+ ▶ gron " https://api.github.com/repos/tomnomnom/gron/commits?per_page=5"
1313json = [];
1414json[0] = {};
1515json[0].author = {};
@@ -23,9 +23,9 @@ json[4].sha = "91b204972e63a1166c9d148fbbfd839f8697f91b";
2323json[4].url = "https://api.github.com/repos/tomnomnom/gron/commits/91b204972e63a1166c9d148fbbfd839f8697f91b";
2424```
2525
26- Extract just the first commit using ` fgrep ' json[0]' ` :
26+ Extract just the first commit using ` fgrep " json[0]" ` :
2727```
28- ▶ gron ' https://api.github.com/repos/tomnomnom/gron/commits?per_page=5' | fgrep ' json[0]'
28+ ▶ gron " https://api.github.com/repos/tomnomnom/gron/commits?per_page=5" | fgrep " json[0]"
2929json[0] = {};
3030json[0].author = {};
3131json[0].author.avatar_url = "https://avatars.githubusercontent.com/u/58276?v=3";
@@ -39,16 +39,16 @@ json[0].sha = "7da81e29c27241c0a5c2e5d083ddebcfcc525908";
3939json[0].url = "https://api.github.com/repos/tomnomnom/gron/commits/7da81e29c27241c0a5c2e5d083ddebcfcc525908";
4040```
4141
42- Get just the committer's name and the commit message using ` egrep ' (committer.name|commit.message)' ` :
42+ Get just the committer's name and the commit message using ` egrep " (committer.name|commit.message)" ` :
4343```
44- ▶ gron ' https://api.github.com/repos/tomnomnom/gron/commits?per_page=5' | fgrep ' json[0]' | egrep ' (committer.name|commit.message)'
44+ ▶ gron " https://api.github.com/repos/tomnomnom/gron/commits?per_page=5" | fgrep " json[0]" | egrep " (committer.name|commit.message)"
4545json[0].commit.committer.name = "Tom Hudson";
4646json[0].commit.message = "Adds 0.1.7 to changelog";
4747```
4848
4949Turn the result back into JSON using ` gron --ungron ` :
5050```
51- ▶ gron ' https://api.github.com/repos/tomnomnom/gron/commits?per_page=5' | fgrep ' json[0]' | egrep ' (committer.name|commit.message)' | gron --ungron
51+ ▶ gron " https://api.github.com/repos/tomnomnom/gron/commits?per_page=5" | fgrep " json[0]" | egrep " (committer.name|commit.message)" | gron --ungron
5252[
5353 {
5454 "commit": {
@@ -63,10 +63,10 @@ Turn the result back into JSON using `gron --ungron`:
6363
6464gron preserves the location of values in the JSON, but you can use ` sed ` to remove keys from the path:
6565```
66- ▶ gron ' https://api.github.com/repos/tomnomnom/gron/commits?per_page=5' | fgrep ' json[0]' | egrep ' (committer.name|commit.message)' | sed -r ' s/(commit|committer)\.//g'
66+ ▶ gron " https://api.github.com/repos/tomnomnom/gron/commits?per_page=5" | fgrep " json[0]" | egrep " (committer.name|commit.message)" | sed -r " s/(commit|committer)\.//g"
6767json[0].name = "Tom Hudson";
6868json[0].message = "Adds 0.1.7 to changelog"
69- ▶ gron ' https://api.github.com/repos/tomnomnom/gron/commits?per_page=5' | fgrep ' json[0]' | egrep ' (committer.name|commit.message)' | sed -r ' s/(commit|committer)\.//g' | gron --ungron
69+ ▶ gron " https://api.github.com/repos/tomnomnom/gron/commits?per_page=5" | fgrep " json[0]" | egrep " (committer.name|commit.message)" | sed -r " s/(commit|committer)\.//g" | gron --ungron
7070[
7171 {
7272 "message": "Adds 0.1.7 to changelog",
@@ -75,9 +75,9 @@ json[0].message = "Adds 0.1.7 to changelog"
7575]
7676```
7777
78- Removing the ` fgrep ' json[0]' ` from the pipeline means we do the same for all commits:
78+ Removing the ` fgrep " json[0]" ` from the pipeline means we do the same for all commits:
7979```
80- ▶ gron ' https://api.github.com/repos/tomnomnom/gron/commits?per_page=5' | egrep ' (committer.name|commit.message)' | sed -r ' s/(commit|committer)\.//g' | gron --ungron
80+ ▶ gron " https://api.github.com/repos/tomnomnom/gron/commits?per_page=5" | egrep " (committer.name|commit.message)" | sed -r " s/(commit|committer)\.//g" | gron --ungron
8181[
8282 {
8383 "message": "Adds 0.1.7 to changelog",
@@ -92,7 +92,7 @@ Removing the `fgrep 'json[0]'` from the pipeline means we do the same for all co
9292
9393To include the ` html_url ` key for each commit's parents, all we need to do is add ` parents.*html_url ` into our call to ` egrep ` :
9494```
95- ▶ gron ' https://api.github.com/repos/tomnomnom/gron/commits?per_page=5' | egrep ' (committer.name|commit.message|parents.*html_url)' | sed -r ' s/(commit|committer)\.//g'
95+ ▶ gron " https://api.github.com/repos/tomnomnom/gron/commits?per_page=5" | egrep " (committer.name|commit.message|parents.*html_url)" | sed -r " s/(commit|committer)\.//g"
9696json[0].name = "Tom Hudson";
9797json[0].message = "Adds 0.1.7 to changelog";
9898json[0].parents[0].html_url = "https://github.com/tomnomnom/gron/commit/48aba5325ece087ae24ab72684851cbe77ce8311";
@@ -102,9 +102,9 @@ json[1].parents[0].html_url = "https://github.com/tomnomnom/gron/commit/3eca8bf5
102102...
103103```
104104
105- To make the structure more like that in the final example in the ` jq ` tutorial, we can use ` sed -r ' s/\.html_url//' ` to remove the ` .html_url ` part of the path:
105+ To make the structure more like that in the final example in the ` jq ` tutorial, we can use ` sed -r " s/\.html_url//" ` to remove the ` .html_url ` part of the path:
106106```
107- ▶ gron ' https://api.github.com/repos/tomnomnom/gron/commits?per_page=5' | egrep ' (committer.name|commit.message|parents.*html_url)' | sed -r ' s/(commit|committer)\.//g' | sed -r ' s/\.html_url//'
107+ ▶ gron " https://api.github.com/repos/tomnomnom/gron/commits?per_page=5" | egrep " (committer.name|commit.message|parents.*html_url)" | sed -r " s/(commit|committer)\.//g" | sed -r " s/\.html_url//"
108108json[0].name = "Tom Hudson";
109109json[0].message = "Adds 0.1.7 to changelog";
110110json[0].parents[0] = "https://github.com/tomnomnom/gron/commit/48aba5325ece087ae24ab72684851cbe77ce8311";
@@ -116,7 +116,7 @@ json[1].parents[0] = "https://github.com/tomnomnom/gron/commit/3eca8bf5e07151f07
116116
117117And, of course, the statements can be turned back into JSON with ` gron --ungron ` :
118118```
119- ▶ gron ' https://api.github.com/repos/tomnomnom/gron/commits?per_page=5' | egrep ' (committer.name|commit.message|parents.*html_url)' | sed -r ' s/(commit|committer)\.//g' | sed -r ' s/\.html_url//' | gron --ungron
119+ ▶ gron " https://api.github.com/repos/tomnomnom/gron/commits?per_page=5" | egrep " (committer.name|commit.message|parents.*html_url)" | sed -r " s/(commit|committer)\.//g" | sed -r " s/\.html_url//" | gron --ungron
120120[
121121 {
122122 "message": "Adds 0.1.7 to changelog",
0 commit comments