Occur with many conditions?
If I want to show only lines that content "Buy"
I use command occur
:
Like this:
Nice.
But I need to show lines that content "Buy"
and 0.00000057
So the result must like this
How I can do this by occur
command?
occur
add a comment |
If I want to show only lines that content "Buy"
I use command occur
:
Like this:
Nice.
But I need to show lines that content "Buy"
and 0.00000057
So the result must like this
How I can do this by occur
command?
occur
add a comment |
If I want to show only lines that content "Buy"
I use command occur
:
Like this:
Nice.
But I need to show lines that content "Buy"
and 0.00000057
So the result must like this
How I can do this by occur
command?
occur
If I want to show only lines that content "Buy"
I use command occur
:
Like this:
Nice.
But I need to show lines that content "Buy"
and 0.00000057
So the result must like this
How I can do this by occur
command?
occur
occur
asked Jan 25 at 16:49
AlexeiAlexei
646211
646211
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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.
add a comment |
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.
- Use
M-x occur Buy
to get matches forBuy
in buffer*Occur*
. - Use
C-x C-q
in buffer*Occur*
, to make it modifiable.
With the cursor at the top of
*Occur*
(M-<
), useM-x keep-lines 0.00000057
, to keep only lines that also match0.00000057
.
- This technique works with all kinds of buffers, including
*grep*
output, for instance. Repeatkeep-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 useflush-lines
andkeep-lines
any number of times, to refine matches.
- This technique works with all kinds of buffers, including
- Use
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.
"single regexp won't do" - Technically, the single regexpBuy.*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
add a comment |
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
});
}
});
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%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
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.
add a comment |
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.
add a comment |
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.
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.
answered Jan 25 at 17:21
zckzck
5,48011354
5,48011354
add a comment |
add a comment |
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.
- Use
M-x occur Buy
to get matches forBuy
in buffer*Occur*
. - Use
C-x C-q
in buffer*Occur*
, to make it modifiable.
With the cursor at the top of
*Occur*
(M-<
), useM-x keep-lines 0.00000057
, to keep only lines that also match0.00000057
.
- This technique works with all kinds of buffers, including
*grep*
output, for instance. Repeatkeep-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 useflush-lines
andkeep-lines
any number of times, to refine matches.
- This technique works with all kinds of buffers, including
- Use
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.
"single regexp won't do" - Technically, the single regexpBuy.*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
add a comment |
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.
- Use
M-x occur Buy
to get matches forBuy
in buffer*Occur*
. - Use
C-x C-q
in buffer*Occur*
, to make it modifiable.
With the cursor at the top of
*Occur*
(M-<
), useM-x keep-lines 0.00000057
, to keep only lines that also match0.00000057
.
- This technique works with all kinds of buffers, including
*grep*
output, for instance. Repeatkeep-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 useflush-lines
andkeep-lines
any number of times, to refine matches.
- This technique works with all kinds of buffers, including
- Use
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.
"single regexp won't do" - Technically, the single regexpBuy.*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
add a comment |
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.
- Use
M-x occur Buy
to get matches forBuy
in buffer*Occur*
. - Use
C-x C-q
in buffer*Occur*
, to make it modifiable.
With the cursor at the top of
*Occur*
(M-<
), useM-x keep-lines 0.00000057
, to keep only lines that also match0.00000057
.
- This technique works with all kinds of buffers, including
*grep*
output, for instance. Repeatkeep-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 useflush-lines
andkeep-lines
any number of times, to refine matches.
- This technique works with all kinds of buffers, including
- Use
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.
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.
- Use
M-x occur Buy
to get matches forBuy
in buffer*Occur*
. - Use
C-x C-q
in buffer*Occur*
, to make it modifiable.
With the cursor at the top of
*Occur*
(M-<
), useM-x keep-lines 0.00000057
, to keep only lines that also match0.00000057
.
- This technique works with all kinds of buffers, including
*grep*
output, for instance. Repeatkeep-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 useflush-lines
andkeep-lines
any number of times, to refine matches.
- This technique works with all kinds of buffers, including
- Use
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.
answered Jan 25 at 18:31
DrewDrew
47.8k462104
47.8k462104
"single regexp won't do" - Technically, the single regexpBuy.*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
add a comment |
"single regexp won't do" - Technically, the single regexpBuy.*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
add a comment |
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.
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%2femacs.stackexchange.com%2fquestions%2f47409%2foccur-with-many-conditions%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