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...
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...
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...
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...
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...
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...
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:...
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:...
- Modified
- 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?
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...
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(...
- Modified
- 20 Oct at 05:9
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...
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...
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
- Modified
- 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...
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...
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...
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...
- Modified
- 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...
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...
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...
- Modified
- 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 ...