If I want to show only lines that content "Buy"
I use command occur
:
Nice.
But I need to show lines that content "Buy"
and 0.00000057
How I can do this by occur
command?
If I want to show only lines that content "Buy"
I use command occur
:
Nice.
But I need to show lines that content "Buy"
and 0.00000057
How I can do this by occur
command?
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.
M-x occur Buy
to get matches for Buy
in buffer *Occur*
.C-x C-q
in buffer *Occur*
, to make it modifiable.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
.
*grep*
output, for instance. Repeat keep-lines
to match as many patterns as you want.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.
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.
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.