Occur with many conditions?












3















If I want to show only lines that content "Buy" I use command occur:



Like this:
enter image description here



enter image description here



Nice.



But I need to show lines that content "Buy" and 0.00000057



So the result must like this
enter image description here



How I can do this by occur command?










share|improve this question



























    3















    If I want to show only lines that content "Buy" I use command occur:



    Like this:
    enter image description here



    enter image description here



    Nice.



    But I need to show lines that content "Buy" and 0.00000057



    So the result must like this
    enter image description here



    How I can do this by occur command?










    share|improve this question

























      3












      3








      3








      If I want to show only lines that content "Buy" I use command occur:



      Like this:
      enter image description here



      enter image description here



      Nice.



      But I need to show lines that content "Buy" and 0.00000057



      So the result must like this
      enter image description here



      How I can do this by occur command?










      share|improve this question














      If I want to show only lines that content "Buy" I use command occur:



      Like this:
      enter image description here



      enter image description here



      Nice.



      But I need to show lines that content "Buy" and 0.00000057



      So the result must like this
      enter image description here



      How I can do this by occur command?







      occur






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 25 at 16:49









      AlexeiAlexei

      646211




      646211






















          2 Answers
          2






          active

          oldest

          votes


















          2














          If you know that BUY always comes before 0.00000057, you can give occur the regex BUY.*0.00000057.



          That will search for all lines that have BUY, any number of characters, then 0.00000057 in it.



          Alternate package



          If you use helm swoop, not only can you specify them in either order (swooping for BUY 0.00000057 is the same as 0.00000057 BUY), but you also get live results, and easier navigation between them.






          share|improve this answer































            4














            If you only care about a particular order (e.g. Buy comes first) then you can use a regexp: Buy.*0.00000057, as mentioned by @zck. But if you need to check for both orders then a single regexp won't do the job.



            To match multiple things in any order, here are two approaches.





            • Use occur, refining its output with multiple patterns.




              1. Use M-x occur Buy to get matches for Buy in buffer *Occur*.

              2. Use C-x C-q in buffer *Occur*, to make it modifiable.


              3. With the cursor at the top of *Occur* (M-<), use M-x keep-lines 0.00000057, to keep only lines that also match 0.00000057.




                • This technique works with all kinds of buffers, including *grep* output, for instance. Repeat keep-lines to match as many patterns as you want.

                • You can also use the dual command flush-lines, to remove lines that match another regexp. You can use flush-lines and keep-lines any number of times, to refine matches.





            • Alternatively, if you use Icicles then you can use any number of patterns together, to match things in any order (for any matching context). Each pattern can be a regexp, literal string, or fuzzy-match pattern.







            share|improve this answer
























            • "single regexp won't do" - Technically, the single regexp Buy.*0.00000057|0.00000057.*Buy should work. Not that I would recommend it though.

              – npostavs
              Jan 26 at 14:10











            • @npostavs: Nor would I. But more important is the general case - any number of things to match, in any order.

              – Drew
              Jan 27 at 2:25











            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "583"
            };
            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%2femacs.stackexchange.com%2fquestions%2f47409%2foccur-with-many-conditions%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            If you know that BUY always comes before 0.00000057, you can give occur the regex BUY.*0.00000057.



            That will search for all lines that have BUY, any number of characters, then 0.00000057 in it.



            Alternate package



            If you use helm swoop, not only can you specify them in either order (swooping for BUY 0.00000057 is the same as 0.00000057 BUY), but you also get live results, and easier navigation between them.






            share|improve this answer




























              2














              If you know that BUY always comes before 0.00000057, you can give occur the regex BUY.*0.00000057.



              That will search for all lines that have BUY, any number of characters, then 0.00000057 in it.



              Alternate package



              If you use helm swoop, not only can you specify them in either order (swooping for BUY 0.00000057 is the same as 0.00000057 BUY), but you also get live results, and easier navigation between them.






              share|improve this answer


























                2












                2








                2







                If you know that BUY always comes before 0.00000057, you can give occur the regex BUY.*0.00000057.



                That will search for all lines that have BUY, any number of characters, then 0.00000057 in it.



                Alternate package



                If you use helm swoop, not only can you specify them in either order (swooping for BUY 0.00000057 is the same as 0.00000057 BUY), but you also get live results, and easier navigation between them.






                share|improve this answer













                If you know that BUY always comes before 0.00000057, you can give occur the regex BUY.*0.00000057.



                That will search for all lines that have BUY, any number of characters, then 0.00000057 in it.



                Alternate package



                If you use helm swoop, not only can you specify them in either order (swooping for BUY 0.00000057 is the same as 0.00000057 BUY), but you also get live results, and easier navigation between them.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jan 25 at 17:21









                zckzck

                5,48011354




                5,48011354























                    4














                    If you only care about a particular order (e.g. Buy comes first) then you can use a regexp: Buy.*0.00000057, as mentioned by @zck. But if you need to check for both orders then a single regexp won't do the job.



                    To match multiple things in any order, here are two approaches.





                    • Use occur, refining its output with multiple patterns.




                      1. Use M-x occur Buy to get matches for Buy in buffer *Occur*.

                      2. Use C-x C-q in buffer *Occur*, to make it modifiable.


                      3. With the cursor at the top of *Occur* (M-<), use M-x keep-lines 0.00000057, to keep only lines that also match 0.00000057.




                        • This technique works with all kinds of buffers, including *grep* output, for instance. Repeat keep-lines to match as many patterns as you want.

                        • You can also use the dual command flush-lines, to remove lines that match another regexp. You can use flush-lines and keep-lines any number of times, to refine matches.





                    • Alternatively, if you use Icicles then you can use any number of patterns together, to match things in any order (for any matching context). Each pattern can be a regexp, literal string, or fuzzy-match pattern.







                    share|improve this answer
























                    • "single regexp won't do" - Technically, the single regexp Buy.*0.00000057|0.00000057.*Buy should work. Not that I would recommend it though.

                      – npostavs
                      Jan 26 at 14:10











                    • @npostavs: Nor would I. But more important is the general case - any number of things to match, in any order.

                      – Drew
                      Jan 27 at 2:25
















                    4














                    If you only care about a particular order (e.g. Buy comes first) then you can use a regexp: Buy.*0.00000057, as mentioned by @zck. But if you need to check for both orders then a single regexp won't do the job.



                    To match multiple things in any order, here are two approaches.





                    • Use occur, refining its output with multiple patterns.




                      1. Use M-x occur Buy to get matches for Buy in buffer *Occur*.

                      2. Use C-x C-q in buffer *Occur*, to make it modifiable.


                      3. With the cursor at the top of *Occur* (M-<), use M-x keep-lines 0.00000057, to keep only lines that also match 0.00000057.




                        • This technique works with all kinds of buffers, including *grep* output, for instance. Repeat keep-lines to match as many patterns as you want.

                        • You can also use the dual command flush-lines, to remove lines that match another regexp. You can use flush-lines and keep-lines any number of times, to refine matches.





                    • Alternatively, if you use Icicles then you can use any number of patterns together, to match things in any order (for any matching context). Each pattern can be a regexp, literal string, or fuzzy-match pattern.







                    share|improve this answer
























                    • "single regexp won't do" - Technically, the single regexp Buy.*0.00000057|0.00000057.*Buy should work. Not that I would recommend it though.

                      – npostavs
                      Jan 26 at 14:10











                    • @npostavs: Nor would I. But more important is the general case - any number of things to match, in any order.

                      – Drew
                      Jan 27 at 2:25














                    4












                    4








                    4







                    If you only care about a particular order (e.g. Buy comes first) then you can use a regexp: Buy.*0.00000057, as mentioned by @zck. But if you need to check for both orders then a single regexp won't do the job.



                    To match multiple things in any order, here are two approaches.





                    • Use occur, refining its output with multiple patterns.




                      1. Use M-x occur Buy to get matches for Buy in buffer *Occur*.

                      2. Use C-x C-q in buffer *Occur*, to make it modifiable.


                      3. With the cursor at the top of *Occur* (M-<), use M-x keep-lines 0.00000057, to keep only lines that also match 0.00000057.




                        • This technique works with all kinds of buffers, including *grep* output, for instance. Repeat keep-lines to match as many patterns as you want.

                        • You can also use the dual command flush-lines, to remove lines that match another regexp. You can use flush-lines and keep-lines any number of times, to refine matches.





                    • Alternatively, if you use Icicles then you can use any number of patterns together, to match things in any order (for any matching context). Each pattern can be a regexp, literal string, or fuzzy-match pattern.







                    share|improve this answer













                    If you only care about a particular order (e.g. Buy comes first) then you can use a regexp: Buy.*0.00000057, as mentioned by @zck. But if you need to check for both orders then a single regexp won't do the job.



                    To match multiple things in any order, here are two approaches.





                    • Use occur, refining its output with multiple patterns.




                      1. Use M-x occur Buy to get matches for Buy in buffer *Occur*.

                      2. Use C-x C-q in buffer *Occur*, to make it modifiable.


                      3. With the cursor at the top of *Occur* (M-<), use M-x keep-lines 0.00000057, to keep only lines that also match 0.00000057.




                        • This technique works with all kinds of buffers, including *grep* output, for instance. Repeat keep-lines to match as many patterns as you want.

                        • You can also use the dual command flush-lines, to remove lines that match another regexp. You can use flush-lines and keep-lines any number of times, to refine matches.





                    • Alternatively, if you use Icicles then you can use any number of patterns together, to match things in any order (for any matching context). Each pattern can be a regexp, literal string, or fuzzy-match pattern.








                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 25 at 18:31









                    DrewDrew

                    47.8k462104




                    47.8k462104













                    • "single regexp won't do" - Technically, the single regexp Buy.*0.00000057|0.00000057.*Buy should work. Not that I would recommend it though.

                      – npostavs
                      Jan 26 at 14:10











                    • @npostavs: Nor would I. But more important is the general case - any number of things to match, in any order.

                      – Drew
                      Jan 27 at 2:25



















                    • "single regexp won't do" - Technically, the single regexp Buy.*0.00000057|0.00000057.*Buy should work. Not that I would recommend it though.

                      – npostavs
                      Jan 26 at 14:10











                    • @npostavs: Nor would I. But more important is the general case - any number of things to match, in any order.

                      – Drew
                      Jan 27 at 2:25

















                    "single regexp won't do" - Technically, the single regexp Buy.*0.00000057|0.00000057.*Buy should work. Not that I would recommend it though.

                    – npostavs
                    Jan 26 at 14:10





                    "single regexp won't do" - Technically, the single regexp Buy.*0.00000057|0.00000057.*Buy should work. Not that I would recommend it though.

                    – npostavs
                    Jan 26 at 14:10













                    @npostavs: Nor would I. But more important is the general case - any number of things to match, in any order.

                    – Drew
                    Jan 27 at 2:25





                    @npostavs: Nor would I. But more important is the general case - any number of things to match, in any order.

                    – Drew
                    Jan 27 at 2:25


















                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Emacs 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%2femacs.stackexchange.com%2fquestions%2f47409%2foccur-with-many-conditions%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

                    How to change which sound is reproduced for terminal bell?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?