Hide lines by regex
I am reading detailed line oriented log file (100MB).
I want to skip some parts by using regex.
Usually I M-x flush-lines but this is destructive operation.
I want to hide many lines by regex and expect it would be efficient when I navigate across file. Extra plus if interactive search skips hidden parts.
From the comments on yue's answer:
I want incremental exclusion (first regex, then next regex).
I search for anomalies in log and know what to exclude but I don't know what I will have found.
hideshow
add a comment |
I am reading detailed line oriented log file (100MB).
I want to skip some parts by using regex.
Usually I M-x flush-lines but this is destructive operation.
I want to hide many lines by regex and expect it would be efficient when I navigate across file. Extra plus if interactive search skips hidden parts.
From the comments on yue's answer:
I want incremental exclusion (first regex, then next regex).
I search for anomalies in log and know what to exclude but I don't know what I will have found.
hideshow
1
Why don't you likeflush-lines
? With a tiny trick you can clone the file buffer into one that does not visit any file and flush lines there. (1) Do you want a list of flushes you have performed to roll back? (2) Do you want to edit the log file (maybe inserting some kind of markers) and keep these edits in hidden regions? Please, expand your question in that regard.
– Tobias
29 mins ago
@Tobias It is exploration of log for some issues and it can be possible that I appliedflush-lines
too aggressively and losing problem. Probably should work on file copy...
– gavenkoa
24 mins ago
I.e. you want to be able to roll-backflush-lines
commands in anundo-tree
fashion maybe including theundo-tree-visualizer-toggle-diff
feature. It would be even nicer to see the flushed regexps aside the undo tree nodes. Something like that? You can use all that on a buffer clone as I stated in my first comment.
– Tobias
14 mins ago
The mentioned strategy is even reasonably fast with large text files (just tried it with 40MB).
– Tobias
8 mins ago
add a comment |
I am reading detailed line oriented log file (100MB).
I want to skip some parts by using regex.
Usually I M-x flush-lines but this is destructive operation.
I want to hide many lines by regex and expect it would be efficient when I navigate across file. Extra plus if interactive search skips hidden parts.
From the comments on yue's answer:
I want incremental exclusion (first regex, then next regex).
I search for anomalies in log and know what to exclude but I don't know what I will have found.
hideshow
I am reading detailed line oriented log file (100MB).
I want to skip some parts by using regex.
Usually I M-x flush-lines but this is destructive operation.
I want to hide many lines by regex and expect it would be efficient when I navigate across file. Extra plus if interactive search skips hidden parts.
From the comments on yue's answer:
I want incremental exclusion (first regex, then next regex).
I search for anomalies in log and know what to exclude but I don't know what I will have found.
hideshow
hideshow
edited 37 mins ago
gavenkoa
asked 2 hours ago
gavenkoagavenkoa
1,320819
1,320819
1
Why don't you likeflush-lines
? With a tiny trick you can clone the file buffer into one that does not visit any file and flush lines there. (1) Do you want a list of flushes you have performed to roll back? (2) Do you want to edit the log file (maybe inserting some kind of markers) and keep these edits in hidden regions? Please, expand your question in that regard.
– Tobias
29 mins ago
@Tobias It is exploration of log for some issues and it can be possible that I appliedflush-lines
too aggressively and losing problem. Probably should work on file copy...
– gavenkoa
24 mins ago
I.e. you want to be able to roll-backflush-lines
commands in anundo-tree
fashion maybe including theundo-tree-visualizer-toggle-diff
feature. It would be even nicer to see the flushed regexps aside the undo tree nodes. Something like that? You can use all that on a buffer clone as I stated in my first comment.
– Tobias
14 mins ago
The mentioned strategy is even reasonably fast with large text files (just tried it with 40MB).
– Tobias
8 mins ago
add a comment |
1
Why don't you likeflush-lines
? With a tiny trick you can clone the file buffer into one that does not visit any file and flush lines there. (1) Do you want a list of flushes you have performed to roll back? (2) Do you want to edit the log file (maybe inserting some kind of markers) and keep these edits in hidden regions? Please, expand your question in that regard.
– Tobias
29 mins ago
@Tobias It is exploration of log for some issues and it can be possible that I appliedflush-lines
too aggressively and losing problem. Probably should work on file copy...
– gavenkoa
24 mins ago
I.e. you want to be able to roll-backflush-lines
commands in anundo-tree
fashion maybe including theundo-tree-visualizer-toggle-diff
feature. It would be even nicer to see the flushed regexps aside the undo tree nodes. Something like that? You can use all that on a buffer clone as I stated in my first comment.
– Tobias
14 mins ago
The mentioned strategy is even reasonably fast with large text files (just tried it with 40MB).
– Tobias
8 mins ago
1
1
Why don't you like
flush-lines
? With a tiny trick you can clone the file buffer into one that does not visit any file and flush lines there. (1) Do you want a list of flushes you have performed to roll back? (2) Do you want to edit the log file (maybe inserting some kind of markers) and keep these edits in hidden regions? Please, expand your question in that regard.– Tobias
29 mins ago
Why don't you like
flush-lines
? With a tiny trick you can clone the file buffer into one that does not visit any file and flush lines there. (1) Do you want a list of flushes you have performed to roll back? (2) Do you want to edit the log file (maybe inserting some kind of markers) and keep these edits in hidden regions? Please, expand your question in that regard.– Tobias
29 mins ago
@Tobias It is exploration of log for some issues and it can be possible that I applied
flush-lines
too aggressively and losing problem. Probably should work on file copy...– gavenkoa
24 mins ago
@Tobias It is exploration of log for some issues and it can be possible that I applied
flush-lines
too aggressively and losing problem. Probably should work on file copy...– gavenkoa
24 mins ago
I.e. you want to be able to roll-back
flush-lines
commands in an undo-tree
fashion maybe including the undo-tree-visualizer-toggle-diff
feature. It would be even nicer to see the flushed regexps aside the undo tree nodes. Something like that? You can use all that on a buffer clone as I stated in my first comment.– Tobias
14 mins ago
I.e. you want to be able to roll-back
flush-lines
commands in an undo-tree
fashion maybe including the undo-tree-visualizer-toggle-diff
feature. It would be even nicer to see the flushed regexps aside the undo tree nodes. Something like that? You can use all that on a buffer clone as I stated in my first comment.– Tobias
14 mins ago
The mentioned strategy is even reasonably fast with large text files (just tried it with 40MB).
– Tobias
8 mins ago
The mentioned strategy is even reasonably fast with large text files (just tried it with 40MB).
– Tobias
8 mins ago
add a comment |
1 Answer
1
active
oldest
votes
You want to use occur. This feature is built-in and it does exactly what you want.
There is also a package called loccur, which does the same, but does not create a new window (it just hides all non matching lines).
I want incremental exclusion (first regex, then next regex).occur
has positive logic instead of negative and I can't apply exclusion sequentially...
– gavenkoa
1 hour ago
I search for anomalies in log and know what to exclude.
– gavenkoa
1 hour ago
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%2f50233%2fhide-lines-by-regex%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
You want to use occur. This feature is built-in and it does exactly what you want.
There is also a package called loccur, which does the same, but does not create a new window (it just hides all non matching lines).
I want incremental exclusion (first regex, then next regex).occur
has positive logic instead of negative and I can't apply exclusion sequentially...
– gavenkoa
1 hour ago
I search for anomalies in log and know what to exclude.
– gavenkoa
1 hour ago
add a comment |
You want to use occur. This feature is built-in and it does exactly what you want.
There is also a package called loccur, which does the same, but does not create a new window (it just hides all non matching lines).
I want incremental exclusion (first regex, then next regex).occur
has positive logic instead of negative and I can't apply exclusion sequentially...
– gavenkoa
1 hour ago
I search for anomalies in log and know what to exclude.
– gavenkoa
1 hour ago
add a comment |
You want to use occur. This feature is built-in and it does exactly what you want.
There is also a package called loccur, which does the same, but does not create a new window (it just hides all non matching lines).
You want to use occur. This feature is built-in and it does exactly what you want.
There is also a package called loccur, which does the same, but does not create a new window (it just hides all non matching lines).
answered 1 hour ago
juejue
1,703112
1,703112
I want incremental exclusion (first regex, then next regex).occur
has positive logic instead of negative and I can't apply exclusion sequentially...
– gavenkoa
1 hour ago
I search for anomalies in log and know what to exclude.
– gavenkoa
1 hour ago
add a comment |
I want incremental exclusion (first regex, then next regex).occur
has positive logic instead of negative and I can't apply exclusion sequentially...
– gavenkoa
1 hour ago
I search for anomalies in log and know what to exclude.
– gavenkoa
1 hour ago
I want incremental exclusion (first regex, then next regex).
occur
has positive logic instead of negative and I can't apply exclusion sequentially...– gavenkoa
1 hour ago
I want incremental exclusion (first regex, then next regex).
occur
has positive logic instead of negative and I can't apply exclusion sequentially...– gavenkoa
1 hour ago
I search for anomalies in log and know what to exclude.
– gavenkoa
1 hour ago
I search for anomalies in log and know what to exclude.
– gavenkoa
1 hour ago
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%2f50233%2fhide-lines-by-regex%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
1
Why don't you like
flush-lines
? With a tiny trick you can clone the file buffer into one that does not visit any file and flush lines there. (1) Do you want a list of flushes you have performed to roll back? (2) Do you want to edit the log file (maybe inserting some kind of markers) and keep these edits in hidden regions? Please, expand your question in that regard.– Tobias
29 mins ago
@Tobias It is exploration of log for some issues and it can be possible that I applied
flush-lines
too aggressively and losing problem. Probably should work on file copy...– gavenkoa
24 mins ago
I.e. you want to be able to roll-back
flush-lines
commands in anundo-tree
fashion maybe including theundo-tree-visualizer-toggle-diff
feature. It would be even nicer to see the flushed regexps aside the undo tree nodes. Something like that? You can use all that on a buffer clone as I stated in my first comment.– Tobias
14 mins ago
The mentioned strategy is even reasonably fast with large text files (just tried it with 40MB).
– Tobias
8 mins ago