tagged [grep]

How to find all files containing specific text (string) on Linux?

How to find all files containing specific text (string) on Linux? How do I find all files containing a specific string of text within their file contents? The following doesn't work. It seems to displ...

27 Sep at 12:52

Match two strings in one line with grep

Match two strings in one line with grep I am trying to use `grep` to match lines that contain two different strings. I have tried the following but this matches lines that contain either which not wh...

10 Jul at 22:57

How to get the process ID to kill a nohup process?

How to get the process ID to kill a nohup process? I'm running a nohup process on the server. When I try to kill it my putty console closes instead. this is how I try to find the process ID: this is t...

22 Sep at 22:40

How to show a 'grep' result with the complete path or file name

How to show a 'grep' result with the complete path or file name How can I get the complete file path when I use `grep`? I use commands like I need to show the result with the complete file path from w...

18 Jun at 17:54

What are good grep tools for Windows?

What are good grep tools for Windows? Any recommendations on [grep](http://en.wikipedia.org/wiki/Grep) tools for Windows? Ideally ones that could leverage 64-bit OS. I'm aware of [Cygwin](http://www.c...

26 Jul at 17:47

How to find and replace all occurrences of a string recursively in a directory tree?

How to find and replace all occurrences of a string recursively in a directory tree? Using just grep and sed, how do I replace all occurrences of: with within a text file under the `/home/user/` direc...

18 Oct at 19:42

How to find patterns across multiple lines using grep?

How to find patterns across multiple lines using grep? I want to find files that have "abc" AND "efg" in that order, and those two strings are on different lines in that file. Eg: a file with content:...

3 Sep at 19:43

How can I have grep not print out 'No such file or directory' errors?

How can I have grep not print out 'No such file or directory' errors? I'm grepping through a large pile of code managed by git, and whenever I do a grep, I see piles and piles of messages of the form:...

10 Aug at 08:35

How do you grep a file and get the next 5 lines

How do you grep a file and get the next 5 lines How do I `grep` a file for `19:55` and get the Line 1,2,3,4,5?

9 Oct at 14:35

grep exclude multiple strings

grep exclude multiple strings I am trying to see a log file using `tail -f` and want to exclude all lines containing the following strings: `Nopaging the limit is` and `keyword to remove is` I am able...

18 May at 09:42

grep for special characters in Unix

grep for special characters in Unix I have a log file (application.log) which might contain the following string of normal & special characters on multiple lines: I want to search for the line number(...

20 Oct at 05:9

How can I pipe stderr, and not stdout?

How can I pipe stderr, and not stdout? I have a program that writes information to `stdout` and `stderr`, and I need to process the `stderr` with `grep`, leaving `stdout` aside. Using a temporary file...

10 Nov at 12:19

How to grep (search) committed code in the Git history

How to grep (search) committed code in the Git history I have deleted a file or some code in a file sometime in the past. Can I grep in the content (not in the commit messages)? A very poor solution i...

29 Oct at 09:38

How to 'grep' a continuous stream?

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 ` command, but with `grep` on the output in order to keep only the lines tha...

13 Mar at 11:0

How to grep for case insensitive string in a file?

How to grep for case insensitive string in a file? I have a file `file1` which ends with `Success...` OR `success...` I want to `grep` for the word `success` in a way which is not case sensitive way. ...

24 Jan at 15:53

How to show only next line after the matched one?

How to show only next line after the matched one? Thanks to this command for every line that has 'blah' in it, I get the output of the line that contains 'blah' and the next line that follows in the l...

27 Apr at 04:34

How can I grep recursively, but only in files with certain extensions?

How can I grep recursively, but only in files with certain extensions? I'm working on a script to [grep](https://en.wikipedia.org/wiki/Grep) certain directories: How can I limit results only to exte

20 Jun at 09:29

How to process each output line in a loop?

How to process each output line in a loop? I have a number of lines retrieved from a file after running the [grep](http://linux.die.net/man/1/grep) command as follows: ``` var=`grep xyz abc.txt` ``` L...

1 Dec at 05:0

List files with certain extensions with ls and grep

List files with certain extensions with ls and grep I just want to get the files from the current dir and only output .mp4 .mp3 .exe files nothing else. So I thought I could just do this: But no, as t...

29 Dec at 19:36

List file names based on a filename pattern and file content?

List file names based on a filename pattern and file content? How can I use Grep command to search `file name` based on a wild card `"LMN2011*"` listing all files with this as beginning? I want to add...

3 Dec at 12:19

Can grep show only words that match search pattern?

Can grep show only words that match search pattern? Is there a way to make grep output "words" from files that match the search expression? If I want to find all the instances of, say, "th" in a numbe...

10 Dec at 15:17

Grep 'binary file matches'. How to get normal grep output?

Grep 'binary file matches'. How to get normal grep output? I've got a grep script that searches through a directory recursively. However the results I get are the following. Notice there are found mat...

20 May at 07:24

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

How can I use grep to show just filenames on Linux? How can I use [grep](https://linux.die.net/man/1/grep) to show just file-names (no in-line matches) on Linux? I am usually using something like: How...

31 Mar at 16:14

Count all occurrences of a string in lots of files with grep

Count all occurrences of a string in lots of files with grep I have a bunch of log files. I need to find out how many times a string occurs in all files. returns Using a pipe I was able to get only fi...

18 Jun at 08:25

Regex (grep) for multi-line search needed

Regex (grep) for multi-line search needed I'm running a `grep` to find any *.sql file that has the word `select` followed by the word `customerName` followed by the word `from`. This select statement ...

3 Nov at 14:52