bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

sed regular expression bug


From: mchilds83
Subject: sed regular expression bug
Date: Fri, 13 Jun 2003 17:05:51 -0700

Hello

I am trying to use sed to search a file for email addresses and replace with 
nothing.

However, while my Regular Expression works with egrep, it does not function as 
expected in sed.

Perhaps it is a problem with my usage of sed, but I've asked a couple 
knowledgeable co-workers which turned up no answers.

My usage is:

cat ./sample | sed 
"s/[a-zA-Z0-9\._-]+@([a-zA-Z]{1}[a-zA-Z0-9-]*\.)+[a-zA-Z]{2,4}//g"

The file sample simply contains a list of email addresses.  When I run this 
command, all email addresses are returned.  If I use the same expression with 
egrep, it works as expected:

egrep -v "[a-zA-Z0-9\._-]+@([a-zA-Z]{1}[a-zA-Z0-9-]*\.)+[a-zA-Z]{2,4}" ./sample

No emails are returned (-v = invert results)

The sample file is just that, once I get this working, I will be using sed in a 
similiar manner as part of a maillog parsing script.

If you can, please let me know what I am doing wrong, or if this is indeed a 
bug with sed.

Regards,
Mike Childs
address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]