changing cron using bash script

How can I change the cron entries only for ABC and XYZ from dosomething_1.0.sh to nowchanged_2.0 using a bash script ?

Any help will be appreciated.

 
# 
# ABC
00,05,10,15,20,25,30,35,40,45,50,55  * * * * /mydir/dosomething_1.0.sh 1>/dev/null 2>&1
#
#
##
# DEF
00,05,10,15,20,25,30,35,40,45,50,55  * * * * /mydir/dosomething_1.0.sh 1>/dev/null 2>&1
#
# 
# XYZ
00,05,10,15,20,25,30,35,40,45,50,55  * * * * /mydir/dosomething_1.0.sh 1>/dev/null 2>&1
#
# 
# LMN
00,05,10,15,20,25,30,35,40,45,50,55  * * * * /mydir/dosomething_1.0.sh 1>/dev/null 2>&1
#

Hi.

Use at your own risk! Take a backup of your crontab file first.

crontab -l | sed '/# ABC/{N; s/dosomething_1.0.sh/nowchanged_2.0/;}' | crontab -

(repeat similar for XYZ)

Thank-you for the quick replay. Work great !

How can I use a wildcard eg. dosome
[*] in the above case ?

For example:

crontab -l | sed '/# ABC/{N; s@dosome.*@nowchanged_2.0 1>/dev/null 2>\&1@;}' | crontab -

Thanks ! it works like charm.