Retrieving values of .json objects using egrep, no -P Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Safely turning a JSON string into an objectUse grep --exclude/--include syntax to not grep through certain filesCan comments be used in JSON?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How do I test for an empty JavaScript object?Why does Google prepend while(1); to their JSON responses?Why can't Python parse this JSON data?Parse JSON in JavaScript?How to prettyprint a JSON file?
What is the escape velocity of a neutron particle (not neutron star)
How do I find out the mythology and history of my Fortress?
Around usage results
What does this Jacques Hadamard quote mean?
How to Make a Beautiful Stacked 3D Plot
Is "Reachable Object" really an NP-complete problem?
How could we fake a moon landing now?
What does "lightly crushed" mean for cardamon pods?
Most bit efficient text communication method?
What are the out-of-universe reasons for the references to Toby Maguire-era Spider-Man in ITSV
How to find all the available tools in mac terminal?
How do I stop a creek from eroding my steep embankment?
When the Haste spell ends on a creature, do attackers have advantage against that creature?
Is the Standard Deduction better than Itemized when both are the same amount?
Using et al. for a last / senior author rather than for a first author
Is it ethical to give a final exam after the professor has quit before teaching the remaining chapters of the course?
What does the "x" in "x86" represent?
How do I make this wiring inside cabinet safer? (Pic)
What is the longest distance a player character can jump in one leap?
Can melee weapons be used to deliver Contact Poisons?
How to down pick a chord with skipped strings?
Delete nth line from bottom
What do you call a floor made of glass so you can see through the floor?
Is safe to use va_start macro with this as parameter?
Retrieving values of .json objects using egrep, no -P
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!Safely turning a JSON string into an objectUse grep --exclude/--include syntax to not grep through certain filesCan comments be used in JSON?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How do I test for an empty JavaScript object?Why does Google prepend while(1); to their JSON responses?Why can't Python parse this JSON data?Parse JSON in JavaScript?How to prettyprint a JSON file?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I currently have an assignment in which I must use egrep to extract objects of a certain type from a .json file. Normally, using grep for this would not be much of a problem, as I can use recursive capturing; however, this requires the -P option, which this assignment forbids. The only options allowed to use with grep for this assignment are -o and -E. I also cannot use other tools such as jq
. With this in mind, how could I capture .json objects that may have an arbitrary number of objects nested within them, which can recursively have objects nested with them, etc.? I might even use "-b" to count how many opening and closing brackets have been encountered, but this is forbidden as well. I cannot see any means of parsing a json file using only egrep, please explain how this can be done.
json regex parsing unix grep
add a comment |
I currently have an assignment in which I must use egrep to extract objects of a certain type from a .json file. Normally, using grep for this would not be much of a problem, as I can use recursive capturing; however, this requires the -P option, which this assignment forbids. The only options allowed to use with grep for this assignment are -o and -E. I also cannot use other tools such as jq
. With this in mind, how could I capture .json objects that may have an arbitrary number of objects nested within them, which can recursively have objects nested with them, etc.? I might even use "-b" to count how many opening and closing brackets have been encountered, but this is forbidden as well. I cannot see any means of parsing a json file using only egrep, please explain how this can be done.
json regex parsing unix grep
add a comment |
I currently have an assignment in which I must use egrep to extract objects of a certain type from a .json file. Normally, using grep for this would not be much of a problem, as I can use recursive capturing; however, this requires the -P option, which this assignment forbids. The only options allowed to use with grep for this assignment are -o and -E. I also cannot use other tools such as jq
. With this in mind, how could I capture .json objects that may have an arbitrary number of objects nested within them, which can recursively have objects nested with them, etc.? I might even use "-b" to count how many opening and closing brackets have been encountered, but this is forbidden as well. I cannot see any means of parsing a json file using only egrep, please explain how this can be done.
json regex parsing unix grep
I currently have an assignment in which I must use egrep to extract objects of a certain type from a .json file. Normally, using grep for this would not be much of a problem, as I can use recursive capturing; however, this requires the -P option, which this assignment forbids. The only options allowed to use with grep for this assignment are -o and -E. I also cannot use other tools such as jq
. With this in mind, how could I capture .json objects that may have an arbitrary number of objects nested within them, which can recursively have objects nested with them, etc.? I might even use "-b" to count how many opening and closing brackets have been encountered, but this is forbidden as well. I cannot see any means of parsing a json file using only egrep, please explain how this can be done.
json regex parsing unix grep
json regex parsing unix grep
asked Mar 8 at 18:46
user2649681user2649681
171112
171112
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55069246%2fretrieving-values-of-json-objects-using-egrep-no-p%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55069246%2fretrieving-values-of-json-objects-using-egrep-no-p%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown