[NTLUG:Discuss] removing text: fighting tr and regex
Victor Brilon
victor at victorland.com
Thu Jul 6 06:01:22 CDT 2006
On Jul 6, 2006, at 3:03 AM, Richard Geoffrion wrote:
> echo "jdoe at example.com (John Doe)" | sed --expression s/\(.*?\)//g
You're almost there:
echo "jdoe at example.com (John Doe)" | sed -e s/\(.*\)//g
To badly paraphrase "The Princess Bride": You keep using the ?
qualifier, I don't think it does what you think it does :)
If you truly want to use the ? qualifier to do what it's supposed to
do (i.e., match the minimal number of chars), just use perl like this:
echo "jdoe at example.com (John Doe)" | perl -n -e 's/\(.*?\)//g;print'
Victor
More information about the Discuss
mailing list