Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sed question (I think)

Status
Not open for further replies.

BIS

Technical User
Jun 1, 2001
1,893
NL
Hallo All,

I have this little script that strips out the From address and inserts it as return path. I use qmail, with mess822 and seek0 (because I have been told to, not because I am a guru on these...)

###

#!/bin/sh
QMAILINJECT="s"; export QMAILINJECT
sender="$(cat - | 822field From | sed 's/^ *//g')"
seek0 0
exec /var/qmail/bin/qmail-inject -f "$sender" "$DEFAULT

###

in my logs I get stuff like this:

<"\"TestUser\"_<testuser"@mydomain.com>..._Unbalanced_'>'/

My question to you people is, can anybody see anything wrong in the sed part? I am very very new to sed...

 
What does
Code:
cat - | 822field From
produce?
What do you expect as result?
Code:
testuser@mydomain.com

I guess something like

sed 's/.*\([a-zA-Z0-9_\.]*@[a-zA-Z0-9_\.]*\)/\1/g'
should work, assuming '_' may be part of an email, while '-' is illegal - not sure about that.

seeking a job as java-programmer in Berlin:
 
Why didn't I think of that...

cat - | 822field From

did not produce the expected result.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top