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

learn more… | top users | synonyms

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
5k 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
465 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
102 views

ignoring errors in find / output

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

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

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
591 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 ...
23
votes
5answers
24k 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
6k 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?