The following command produces matches.

# egrep ^[\[].+[\]] /var/log/apache2/error.log

 

However, if I save the pattern to a file and use the –f option, it produces no matches.

I have to change the pattern to this:

^[\[].+\]

 

Notice I had to remove the enclosing square brackets to get the literal closing bracket to match when using the –f option.

This is on a Debian Squeeze system. Below is the package information. I am happy to provide more details if you needed.

# apt-cache show grep

 

Package: grep

Essential: yes

Priority: required

Section: utils

Installed-Size: 1148

Maintainer: Anibal Monsalve Salazar <anibal@debian.org>

Architecture: amd64

Version: 2.6.3-3+squeeze1

Provides: rgrep

Depends: dpkg (>= 1.15.4) | install-info

Pre-Depends: libc6 (>= 2.3)

Suggests: libpcre3 (>= 7.7)

Conflicts: rgrep

Filename: pool/main/g/grep/grep_2.6.3-3+squeeze1_amd64.deb

Size: 313920

MD5sum: 7c8b301e28fc614cd99b04ea87ad0fee

SHA1: 7ebde8d23c4efe40d6744ec9f79133c37b7d2150

SHA256: e0bb207f1446f5b560540df30cee048fe623b5de164c5e035323cffb59de1736

Description: GNU grep, egrep and fgrep

'grep' is a utility to search for text in files; it can be used from the

command line or in scripts.  Even if you don't want to use it, other packages

on your system probably will.

.

The GNU family of grep utilities may be the "fastest grep in the west".

GNU grep is based on a fast lazy-state deterministic matcher (about

twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper

search for a fixed string that eliminates impossible text from being

considered by the full regexp matcher without necessarily having to

look at every character. The result is typically many times faster

than Unix grep or egrep. (Regular expressions containing backreferencing

will run more slowly, however.)

Homepage: http://www.gnu.org/software/grep/

Tag: implemented-in::c, interface::commandline, role::program, scope::utility, suite::gnu, use::searchin

 

Package: grep

Essential: yes

Status: install ok installed

Priority: required

Section: utils

Installed-Size: 768

Maintainer: Anibal Monsalve Salazar <anibal@debian.org>

Architecture: amd64

Version: 2.6.3-3

Provides: rgrep

Depends: dpkg (>= 1.15.4) | install-info

Pre-Depends: libc6 (>= 2.3)

Suggests: libpcre3 (>= 7.7)

Conflicts: rgrep

Description: GNU grep, egrep and fgrep

'grep' is a utility to search for text in files; it can be used from the

command line or in scripts.  Even if you don't want to use it, other packages

on your system probably will.

.

The GNU family of grep utilities may be the "fastest grep in the west".

GNU grep is based on a fast lazy-state deterministic matcher (about

twice as fast as stock Unix egrep) hybridized with a Boyer-Moore-Gosper

search for a fixed string that eliminates impossible text from being

considered by the full regexp matcher without necessarily having to

look at every character. The result is typically many times faster

than Unix grep or egrep. (Regular expressions containing backreferencing

will run more slowly, however.)

Homepage: http://www.gnu.org/software/grep/

 

 

Aaron Selk

Information Services

4910 Burlington Way

Tacoma, WA 98409

Ph: 253.473.5000

Fax: 253.473.5104

www.generalplastics.com

 

emailsig-logo

                              facebook_resized twitter_resized linkedin_resized youtube_resized

 

The contents of this electronic message and any attachments are considered confidential and are intended only for the use of the individual or entity

identified above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this

communication is strictly prohibited. If you have received this e-mail in error, please notify the sender and delete this message, as well as any attachments.