[lug] sed from cron job fails (works from command line)
Kenneth D. Weinert
kenw at quarter-flash.com
Sat Oct 20 13:55:04 MDT 2007
It *might* be a quoting issue. Try adding a -x to the /bin/sh line and
see if the sed command still looks like you expect it to. The -x turns
on verboseness (basically) so you'll see the command echoed before it
runs.
On Sat, 2007-10-20 at 12:04 -0600, Ben wrote:
> 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
>
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: lug.boulder.co.us port=6667 channel=#colug
--
Ken Weinert
http://quarter-flash.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20071020/8a565046/attachment.pgp>
More information about the LUG
mailing list