9 Answered Questions for the topic grep


grep regex to ignore comment at end of line?

I'm trying to grep through a lot of old PowerBASIC source files in search of a variable, but I'm having trouble getting `grep` to avoid matching references to the variable in the end-of-line... more
Grep Linux


How can I use grep to show just filenames on Linux?

How can I use `grep` to show just file-names (no in-line matches) on Linux? I am usually using something like: find . -iname "*php" -exec grep -H myString {} \\; How can I just get the... more
Grep Linux Unix Bash


How can I format my grep output to show line numbers at the end of the line, and also the hit count?

I'm using grep to match string in a file. Here is an example file: example one, example two null, example three, example four null, `grep -i null myfile.txt` returns example two null, ... more
Grep Unix


grep a tab in UNIX?

How do I `grep` tab (\ ) in files on the Unix platform?
Grep Linux Unix


How can I exclude directories from grep -R?

I want to traverse all subdirectories, except the "node_modules" directory.


How to 'grep' a continuous stream?

Is that possible to use `grep` on a continuous stream? What I mean is sort of a `tail -f <file>` command, but with `grep` on the output in order to keep only the lines that interest... more


How to grep a string in a directory and all its subdirectories' files in LINUX?

How to grep a string or a text in a directory and all its subdirectories'files in LINUX ??
Grep Linux Unix


How do I grep recursively?

How do I recursively `grep` all directories and subdirectories? find . | xargs grep "texthere" *


grep, but only certain file extensions?

I am working on writing some scripts to `grep` certain directories, but these directories contain all sorts of file types. I want to `grep` just `.h` and `.cpp` for now, but maybe a few others in... more

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.