grep is a command-line tool for searching text patterns in files.

learn more… | top users | synonyms

11
votes
4answers
14k views

Linux Command to find Strings in Binary or non ascii file

Is there any linux command to extracts all the ascii strings from an executable or other binary file? I suppose I could do it with a grep, but I remember hearing somewhere that such a command existed? ...
1
vote
5answers
3k views

Don't need the whole line, just the match from regular expression

I simply need to get the match from a regular expression: $ cat myfile.txt | SOMETHING_HERE "/(\w).+/" The output has to be only what was matched, inside the parenthesis. Don't think I can use ...
1
vote
3answers
3k views

SED Find & Replace w\ Regular Expressions

Alright, So i'm confused & out of ideas. I'm trying to replace all the old IP addresses with a new one. find -type f | grep \.php$ | xargs sed -r -i ...
2
votes
9answers
1k views

How to reproduce grep's --recursive option in an old version of grep

I am working on an ancient UNIX whose grep lacks the -r/--recursive option. I need to find an error that our application is causing, but I do not know which log file our application is writing ...
8
votes
6answers
6k views

How do i get the default gateway in LINUX given the destination?

I'm trying to get the default gateway, using the destination 0.0.0.0 i used this command: netstat -rn | grep 0.0.0.0 and it returns this list: Destination - Gateway - Genmask - Flags - ...
1
vote
4answers
469 views

Unable to grep sourced Files in Vim

I have files which I source in my files. I want to search them, when I am at a file which have these sources. I run unsuccessfully !bufdo grep source and !bufdo grep source % Example of ...
1
vote
1answer
105 views

ignoring errors in find / output

how do I filter out permissions errors out of find / | grep foo output?
44
votes
12answers
57k views

Do you have any useful awk and grep scripts for parsing apache logs? [closed]

I can use log analyzers, but often I need to parse recent web logs to see what's happening at the moment. I sometimes do things like to figure out top 10 ips that request a certain file cat foo.log ...
1
vote
1answer
601 views

How does one simular the old unix grep -S strict functionality in linux (CentOS 5.2)

I am grepping the output of a command and I wish to only return specific, strict results. I remember some iteration of grep had a strict option -s/--strict. example: command | grep -i bytes This ...
26
votes
5answers
26k views

Recursive text search with grep and file patterns

Given this example folder structure: /folder1/file1.txt /folder1/file2.djd /folder2/file3.txt /folder2/file2.fha How do I do a recursive text search on all *.txt files with grep from "/"? ("grep ...
6
votes
6answers
8k views

How to Find a file in FreeBSD

I'm trying to locate all copies of example.filename on my FreeBSD server. What's the best / easiest / most efficient way to do this?