Questions tagged [grep]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
1answer
15 views

Does grepping via helm support searching for multiple words in any order like other helm completions?

When searching multiple terms with Helm separated with spaces then Helm returns the results which mach the terms in any order. This is good. Sometimes I try grep via helm. E.g. I use helm-recentf to ...
4
votes
3answers
258 views

Grep pipe support and how to filter grep results

I try to filter the output of M-x grep with grep --color=always -nH -e "text_to_find" ~/path/to/files/*.org | grep -v "text_to_ignore" but it doesn't seem to be working. The 'to be ignored' part is ...
0
votes
0answers
64 views

Search in recent files

I use helm-recentf to receive the list of recent files. I would like to have an opportunity to search over the list of recently viewed files. Can I do it with grep or helm-swoop? Is there any other ...
0
votes
1answer
34 views

Cannot jump to file or location link in grep-mode or compile-mode

I have recently installed emacs on a new system (Manjaro arch-linux), using my usual configuration (available here, if relevant). However, the jump function never works on this new system: whenever ...
1
vote
0answers
32 views

How to make `helm-projectile-grep` do a recursive search?

I use helm with projectile and treemacs, how do I make helm-projectile-grep command to search in all project folders recursively starting at the project root. According to this page helm-projectile ...
4
votes
3answers
115 views

How to ignore backup files (~) when running grep?

M-x grep can be used to find strings in files. But I'm not interested in backup files (those whose name ends with a ~). How should I ignore those files when using the grep command?
2
votes
1answer
146 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
170 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
62 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
136 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
176 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
35 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 ...
2
votes
1answer
358 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
81 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 ...
5
votes
2answers
887 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
182 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?
1
vote
1answer
45 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
181 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
137 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
133 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 ...
6
votes
3answers
660 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 ...
2
votes
3answers
94 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.
3
votes
2answers
196 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 ...
1
vote
0answers
50 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
535 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.
2
votes
1answer
124 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
58 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
3answers
390 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
154 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 ...
11
votes
5answers
5k 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
196 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
201 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
233 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 ...
4
votes
1answer
117 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 ...
3
votes
2answers
936 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
87 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
693 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
209 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,...
10
votes
6answers
6k 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 ...