sed's greediness seemingly violatedPrinting match groups with grepgrep block of linesgrep for string like...

Using a concentration spell on top of another spell from another spell list?

How to securely dispose of a smartphone?

Symbol for "not absolutely continuous" in Latex

Losing queen and then winning the game

Can White Castle? #3

If two black hole event horizons overlap (touch) can they ever separate again?

Why does the same classical piece sound like it's in a different key in different recordings?

Is there a canon reason why Klingon and Romulan vessels are so similar in shape?

Can a function nowhere continuous have a connected graph?

Most elegant way to write a one shot IF

Could human civilization live 150 years in a nuclear-powered aircraft carrier colony without resorting to mass killing/ cannibalism?

For decoupling an IC's power supply pins, is there any reason to use multiple capacitances when all the MLCCs have the same package size?

Donkey as Democratic Party symbolic animal

Put my student loan in parents’ second mortgage - help?

Multiple computers 1 minecraft

How did researchers find articles before the Internet and the computer era?

Can an editor review manuscript without sending to reviewers?

How can a valley surrounded by mountains be fertile and rainy?

Can you actually break an FPGA by programming it wrong?

How did Lefschetz do mathematics without hands?

Which is better for keeping data primary partition or logical partition?

Are all commands with an optional argument fragile?

Could a Weapon of Mass Destruction, targeting only humans, be developed?

Can the Raspberry Pi 4 better distribute Python scripts to all four cores?



sed's greediness seemingly violated


Printing match groups with grepgrep block of linesgrep for string like xxx12345Grep on single lineIs there any alternative to the “sed -i” command in Solaris?Pattern matching and grep togetherFactoring a grep out of a grep | sed stream or writing grep in sed?How to improve this 'sed' search & replace command?How to find and replace seemingly a tab char using sed?What does this grep and sed command do






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I would have thought these two invocations of sed would return the same output given that it looks for patterns in a greedy fashion by default. Why not?



$ echo '<a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a>' | grep -E '<a href="/topic.*</a>' | sed 's/<a href=.*">//'
Null hypothesis</a>

$ echo '<a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a>' | grep -E '<a href="/topic.*</a>' | sed 's/<a href=.*>//'


PS:



$ bash --version
bash --version
GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)


PS2: I corrected from sed to grep.



PS3: Corrected back from grep to sed.










share|improve this question































    0















    I would have thought these two invocations of sed would return the same output given that it looks for patterns in a greedy fashion by default. Why not?



    $ echo '<a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a>' | grep -E '<a href="/topic.*</a>' | sed 's/<a href=.*">//'
    Null hypothesis</a>

    $ echo '<a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a>' | grep -E '<a href="/topic.*</a>' | sed 's/<a href=.*>//'


    PS:



    $ bash --version
    bash --version
    GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)


    PS2: I corrected from sed to grep.



    PS3: Corrected back from grep to sed.










    share|improve this question



























      0












      0








      0








      I would have thought these two invocations of sed would return the same output given that it looks for patterns in a greedy fashion by default. Why not?



      $ echo '<a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a>' | grep -E '<a href="/topic.*</a>' | sed 's/<a href=.*">//'
      Null hypothesis</a>

      $ echo '<a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a>' | grep -E '<a href="/topic.*</a>' | sed 's/<a href=.*>//'


      PS:



      $ bash --version
      bash --version
      GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)


      PS2: I corrected from sed to grep.



      PS3: Corrected back from grep to sed.










      share|improve this question
















      I would have thought these two invocations of sed would return the same output given that it looks for patterns in a greedy fashion by default. Why not?



      $ echo '<a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a>' | grep -E '<a href="/topic.*</a>' | sed 's/<a href=.*">//'
      Null hypothesis</a>

      $ echo '<a href="/topic/null-hypothesis/" data-sc="text link:topic link">Null hypothesis</a>' | grep -E '<a href="/topic.*</a>' | sed 's/<a href=.*>//'


      PS:



      $ bash --version
      bash --version
      GNU bash, version 4.4.19(1)-release (x86_64-pc-linux-gnu)


      PS2: I corrected from sed to grep.



      PS3: Corrected back from grep to sed.







      sed






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 25 secs ago







      Erwann

















      asked 37 mins ago









      ErwannErwann

      391 silver badge8 bronze badges




      391 silver badge8 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          0














          I don't see any violation here. "> is matched by the end of link">, but not by the end of </a>, which is matched by just >.






          share|improve this answer
























          • I didn't say there was a violation, but a seeming one. The interrogation pertains not to the first invocation, but the second: I would like to match the first >.

            – Erwann
            27 mins ago













          • Well, no violation, seemingly or otherwise. If you would like to match the first >, then you will need to exclude > from the characters matched in between. [^>]*>

            – muru
            23 mins ago














          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          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: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          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%2funix.stackexchange.com%2fquestions%2f526942%2fseds-greediness-seemingly-violated%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          I don't see any violation here. "> is matched by the end of link">, but not by the end of </a>, which is matched by just >.






          share|improve this answer
























          • I didn't say there was a violation, but a seeming one. The interrogation pertains not to the first invocation, but the second: I would like to match the first >.

            – Erwann
            27 mins ago













          • Well, no violation, seemingly or otherwise. If you would like to match the first >, then you will need to exclude > from the characters matched in between. [^>]*>

            – muru
            23 mins ago
















          0














          I don't see any violation here. "> is matched by the end of link">, but not by the end of </a>, which is matched by just >.






          share|improve this answer
























          • I didn't say there was a violation, but a seeming one. The interrogation pertains not to the first invocation, but the second: I would like to match the first >.

            – Erwann
            27 mins ago













          • Well, no violation, seemingly or otherwise. If you would like to match the first >, then you will need to exclude > from the characters matched in between. [^>]*>

            – muru
            23 mins ago














          0












          0








          0







          I don't see any violation here. "> is matched by the end of link">, but not by the end of </a>, which is matched by just >.






          share|improve this answer













          I don't see any violation here. "> is matched by the end of link">, but not by the end of </a>, which is matched by just >.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 30 mins ago









          murumuru

          40.2k5 gold badges98 silver badges172 bronze badges




          40.2k5 gold badges98 silver badges172 bronze badges













          • I didn't say there was a violation, but a seeming one. The interrogation pertains not to the first invocation, but the second: I would like to match the first >.

            – Erwann
            27 mins ago













          • Well, no violation, seemingly or otherwise. If you would like to match the first >, then you will need to exclude > from the characters matched in between. [^>]*>

            – muru
            23 mins ago



















          • I didn't say there was a violation, but a seeming one. The interrogation pertains not to the first invocation, but the second: I would like to match the first >.

            – Erwann
            27 mins ago













          • Well, no violation, seemingly or otherwise. If you would like to match the first >, then you will need to exclude > from the characters matched in between. [^>]*>

            – muru
            23 mins ago

















          I didn't say there was a violation, but a seeming one. The interrogation pertains not to the first invocation, but the second: I would like to match the first >.

          – Erwann
          27 mins ago







          I didn't say there was a violation, but a seeming one. The interrogation pertains not to the first invocation, but the second: I would like to match the first >.

          – Erwann
          27 mins ago















          Well, no violation, seemingly or otherwise. If you would like to match the first >, then you will need to exclude > from the characters matched in between. [^>]*>

          – muru
          23 mins ago





          Well, no violation, seemingly or otherwise. If you would like to match the first >, then you will need to exclude > from the characters matched in between. [^>]*>

          – muru
          23 mins ago


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • 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%2funix.stackexchange.com%2fquestions%2f526942%2fseds-greediness-seemingly-violated%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

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...