[lug] sed from cron job fails (works from command line)

Ben bluey at iguanaworks.net
Sat Oct 20 12:04:25 MDT 2007


I've got a bash script that runs fine from the command line, but when I
call it from cron.daily, I get the error

sed: -e expression #1, char 139: Invalid range end

The bash script is (slight simplified)


#!/bin/sh
cat somefile|sed -e 's/\(.*RCPT\ from\ \)\([a-Z0-9\.\-]*\)\[\([0-9\.]*
\)]:\ \(.*;\).*from=<\(.*\)>\ to=<\(.*\)>\ proto.*helo=<\(.*\)>.*/\2\t\3
\t\5\t\6\t\7\t\4/g'



I'm guessing that some environment variable is messing up the char
escaping of the sed line, but basically I'm stuck since it works from
the command line. 

Thanks,

Ben




More information about the LUG mailing list