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;








0















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.










share|improve this question




























    0















    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.










    share|improve this question
























      0












      0








      0








      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.










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 8 at 18:46









      user2649681user2649681

      171112




      171112






















          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
          );



          );













          draft saved

          draft discarded


















          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















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved