Hi.
Replace `s///' by `s@@@':
Code:
/usr/bin/perl -i -p -e "s@0 6 * * 0 /dir1/dir2/dir3/filename -q >/dev/null 2>&1@@g" /crontab
Slashes in path name conflict with s///. Alternatively you can escape all slashes in path name: "\/dir1\/dir2...".
EDIT: Also note that some symbols, such as `*', have special meaning inside regular expressions, so you should esape them if you need literals: `\*' etc.
I'd recommend you to use a unique substring of the string you want to delete, for example:
Code:
/usr/bin/perl -i -p -e "s@.*hourly.*@@g" crontab
to remove
Code:
17 * * * * root cd / && run-parts --report /etc/cron.hourly