Apache Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsSystem AdministrationApache Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 25th, 2001, 05:36 AM
djl's Avatar
djl djl is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: London, UK.
Posts: 469 djl User rank is Private First Class (20 - 50 Reputation Level)djl User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 29 m
Reputation Power: 8
/bin/sed ??

I wasn't too sure where to post this question. I assumed as it was server side and something to do with Apache i would post here.

I have a forwarder for an e-mail address being pointed to a PHP script. This all worked fine until a user put a " in the message body.
To combat this i was told to point the forwarder to sed to take out the " or replace them. This would then repoint the outputted text to my php script again.
In theory it should work, but in practice, a different story.
Below is that command that the forwarder has:

| /bin/sed 's/\"/\\\\\"/g' -e | php -q /home/username/catch.php " $h_subject " "$sender_address" "$message_body"

In theory, or what ive been told, is this should remove the unwanted " in the passed along email.
But, theres a problem which i cant figure out.
I get a lovely error email, shown below:


This message was created automatically by mail delivery software (Exim).

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:


pipe to | /bin/sed 's/"/\\"/g' -e | php -q /home/username/catch.php " help " "me@mydomain.com" "work?? "i hope" so "
generated by testaddress@mydomain.com
Child process of virtual_address_pipe transport returned 1 from command:
/bin/sed


The following text was generated during the delivery attempt:


------ pipe to | /bin/sed 's/"/\\"/g' -e | php -q /home/username/catch.php " help " "me@mydomain.com" "work?? "i hope" so "
generated by testaddress@mydomain.com ------


/bin/sed: -e expression #1, char 1: Unknown command: ``|''


Does anyone have any ideas why this isnt working? or even better a solution??

Thanks for any help received,

David

Reply With Quote
  #2  
Old October 25th, 2001, 06:10 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Why are you using the -e switch without any command?
You should either remove the -e or place it right after /bin/sed.

>> I wasn't too sure where to post this question

Definitely not Apache forum. I'd say: 1) UNIX; 2) Mail Servers; 3) PHP

Reply With Quote
  #3  
Old October 25th, 2001, 06:14 AM
djl's Avatar
djl djl is offline
PHPer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: London, UK.
Posts: 469 djl User rank is Private First Class (20 - 50 Reputation Level)djl User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 10 h 29 m
Reputation Power: 8
Ok, i shall remember for next time where to post, sorry

If you mean using sed like this:
| /bin/sed -e 's/\"/\\\\\"/g' | php -q /home/username/catch.php " $h_subject " "$sender_address" "$message_body"

Then i tried that with the -e after /bin/sed
Still doesnt like it.

Anything else?

David

Reply With Quote
  #4  
Old October 25th, 2001, 06:39 AM
freebsd freebsd is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2001
Posts: 5 freebsd User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Why can't you just cat message_file | sed 's/"/\\"/g' and see? That's all that has to do with sed.

Now that I think your catch.php has its own problem and you should look for a better solution to parse email message.

If you are just doing it on the command line, there are many program out there that can parse email message for you. There is no need to call a PHP binary and go thru your catch.php at all.

Reply With Quote
Reply

Viewing: Dev Shed ForumsSystem AdministrationApache Development > /bin/sed ??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway