Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [grep]

The tag has no usage guidance.

1
vote
1answer
24 views

Grep exited abnormally with code 2

Windows 10, Emacs 26.1 M-x shell grep here result: grep Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep --help' for more information. Nice. Now I want to find files in temp folder: rgrep ...
3
votes
2answers
98 views

Unable to visit file from grep results

I recently updated to emacs 26.1. Since then, grep results are not highlighted and does not contain links to files. 'n' or 'p' gives "Moved past last grep hit" or "Moved back before first grep hit". ...
3
votes
1answer
41 views

Have compilation errors / grep match reuse current frame/window without ever splitting it?

I have searched in a number of places (1, 2, 3, 4) even looked at the e-lisp source files and could not figure out how to do, so I ask. Context I have bound next-error to a key. I'm in some source ...
3
votes
1answer
75 views

Jump to file and line number in grep file

$ grep -nrH would . | tee file.txt $ emacs file.txt If I have a buffer with grep search results, how can I make Emacs jump to the file and line number on the cursor line, similar to diff-goto-source ...
1
vote
1answer
127 views

color rgrep matching results in the rgrep results buffer

I am liking rgrep as it lets you choose a path and searches recursively. How is it possible to highlight the matches in the rgrep buffer?
1
vote
0answers
31 views

`find-grep` (aka `grep-find`) not finding a line when in an upper directory

[Top-posting an update] Results of deeper inquiry, after filing a bug report. It appears that the failure is related to a recent update to the cygwin environment. Where previously the single-quoted ...
1
vote
1answer
231 views

find-grep-dired: find exited abnormally with code 1

Windows 10, Emacs 25.1, Dired+ I want in Dired to find all files that contain text "UserOptions". M-x find-grep-dired In folder ca UserOptions And here result: find exited abnormally with code 1 ...
1
vote
0answers
58 views

grep view limit line lengths

When I grep inside emacs, it begins to be completelly laggy when lines are too long (just try to grep in your home emacs directory and you will see what I mean). How to set limit to line lengths in ...
0
votes
0answers
116 views

How to prevent grep results from opening in a specific window

Lets say I have 4 windows open. In one of them I'm running a shell command that is constantly compiling the files that i'm modifying. I want to keep this buffer visible at all times. In one of my ...
4
votes
2answers
511 views

Advanced git grep from within emacs

I've been playing with vc-git-grep as pointed to by this answer How do you grep from within emacs ( git grep 'foo' | grep baa ) I have a special requirement like this: $ git grep -e 'include'...
2
votes
1answer
145 views

How do you grep from within emacs ( git grep 'foo' | grep baa )

I do this often after shelling out to bash $ git grep 'banner-image' | grep mb3 Can I do it without leaving emacs?
0
votes
0answers
38 views

why has my emacs grep command started to search always in my home directory?

Up until a few weeks ago, I was able to use emacs grep to search files in the same directory as the file in the currently active buffer. If I searched recursively, the starting directory would also be ...
1
vote
1answer
40 views

Paths not hyperlinking correctly

Recently when running compile, the error messages don't get hyperlinked properly. I get this type of error message: ../build/obj/DerivedClass.cpp:45:18: error: expected type-specifier The buffer ...
9
votes
3answers
132 views

Is it possible to remove matches manually in grep mode?

After running (grep) the grep buffer appears with matches. Some of the matches are not relevant, and it would be good to remove them manually. This way I can use the grep buffer to hold only those ...
1
vote
3answers
117 views

How do I create a command that searches a specific directory?

I would like to create a command (C-s C-k or something?) that searches a specific directory every time I call it. It would search files within that directory for a string (may contain spaces) and then ...
3
votes
2answers
115 views

How can I create a new buffer for the second run of grep, to avoid overwriting the results of the first run of grep?

When I run grep by M-x grep, I get results in a buffer. When i run grep again M-x grep, the new results overwrite the previous ones in the same buffer. How can I create a new buffer for the second ...
7
votes
3answers
538 views

How to grep marked files in the dired mode of emacs?

I hope it's a simple problem.. I'd like to search for the regexp 'thisWord' only in the marked files of a dired buffer. Usually I used in the dired buffer: M-x grep and then in the mini-buffer grep ...
3
votes
3answers
89 views

Is there a command in emacs similar to `find` in findutils?

In emacs, the command M-x grep runs grep program. Is there a command in emacs for running find in findutils, or do similar thing? Thanks.
2
votes
2answers
143 views

Show the matching line in the center of the screen instead of the bottom when opening a grep result

When I grep something inside emacs and click to open one of the matching files. The matching line is always displayed at the bottom of the screen, and I have to scroll it up for a better view. Is it ...
0
votes
0answers
39 views

Can emacs emulate zgrep -a in zrgrep?

Currently I can grep (in command line) the gzip files I receive using the command zgrep -a something logs.tar.gz it outputs every line inside the logs.tar.gz but without the file where it was found, ...
2
votes
1answer
362 views

rgrep : visiting matches without switching buffer

I was wondering if there is a way to visit the matches listed in the grep buffer without actually switching to the match buffer, similarly to C-o with Occur.
3
votes
1answer
106 views

grep/ag/etc results buffer: how to strip leading whitespace?

I'm using ag.el as a front-end for the ag search utility. The results are displayed in a compilation buffer in the form <file>:<line>:<column>:<matching-text>. The matching-...
5
votes
1answer
57 views

Search files by content using full boolean expressions

Suppose I want to find all *tex files recursively from a given directory containing foo and bar but not doe. I am looking for something like helm-do-ag, but that doesn't seem to support the not ...
2
votes
2answers
303 views

Multiple grep results buffers

Let's say I want to grep word1 and word2. If I use the grep command for word1 I get the results in the *grep* buffer. If I then use the grep command for word2 I loose the old results and get the ...
0
votes
1answer
137 views

How to enable “Entering Directory” matching in grep output?

I have a grep-like script that I run via M-x grep, that changes its working directory, but outputs make-like "Entering directory `/a/b/c/d'" messages (to keep emacs informed). This has worked fine ...
10
votes
5answers
4k views

How to recursively search / grep file contents in a directory / subdirectories in Emacs?

I'm using Emacs for quite some time and I still somehow fail to understand what is the best way to (recursively) grep for a string within a (project) directory and get the results presented either as ...
5
votes
2answers
176 views

How to grep all the Info manuals with a regexp search

People often recommend on emacs.stackexchange.com and stackoverflow.com (in the Emacs tag) that we should learn to "ask Emacs". The built-in Info-mode is not capable of performing a recursive regexp ...
2
votes
1answer
170 views

How to align grep output?

I use grep-mode for a set of files and wgrep (writable grep buffer) for editing them. The buffer usually looks like: I want to find a way to change the view like this: wgrep and compile-goto-error ...
2
votes
0answers
221 views

How can I replace grep with sift or ag in helm-grep? (Not helm-do-ag)

I've currently got a custom function that I use to grep through files in helm. ;; Search for the thing that the cursor is on or that's already hilighted. If there's nothing, ;; switch back to ...
5
votes
1answer
101 views

How can I recenter grep or compile window on next error

On next-error in the grep or compilation window, I can use something like (setq next-error-recenter 35) to ensure that window displaying the match scrolls to show the whole match, as described in ...
4
votes
2answers
799 views

Read find-grep exclusion patterns from a .findignore file

I am aware that you can customise the "find" command executed when using "find-grep" with "setq grep-find-command" and define which file-patterns to ignore in the search. I would like to take this ...
0
votes
1answer
78 views

wgrep for special multiline grep (pcregrep)

wgrep works well for every line in context search like grep -C 2. It also works for grepmail, special grep-like program for mailboxes. You can edit each line of output. How to force pcregrep with ...
4
votes
0answers
612 views

projectile grep file filter

I'm trying to use helm-projectile-grep function on Windows 7, but it searches in every file, though in .projectile I excluded file types which I don't want to work with. Do I have to configure grep ...
3
votes
2answers
190 views

Emacs term loses characters when using ps and grep

I'm trying to use different terminals on Emacs. The one I'm currently trying is term. When I execute a ps command and grep its output on Emacs, I don't get the same result as in gnome-terminal, xterm,...
8
votes
6answers
5k views

Recursive grep in directory with helm and/or projectile?

A recursive grep in a directory should be the simplest thing, but I haven't found the recipe to get it to work yet. I'm juggling between the following commands and am not sure which has the ...