sed adding/removing comment in crontab

I have a requirement where I want to add a comment '#' in my crontab, run a process, than remove the '#' I added.

Example cron

#5,10 * * * * ls -lt /tmp
10,5 * * * * ls -lt /var

I would like to be able use sed or awk to add a '#' at the begining of each
line. After the command my crontab should look like this.

##5,10 * * * * ls -lt /tmp
#10,5 * * * * ls -lt /var

Though I triied this on a regular file I believe I know how to remove only the first occurance '#' ONLY, which would leave me with my original cron

 sed -e 's/#//' | crontab

#5,10 * * * * ls -lt /tmp
10,5 * * * * ls -lt /var

IMO:
Comment: aagh! don't do that. No sed. No awk.

Use the crontab command only. Some people have used vi, but editor settings have the potential to render your whole crontab into garbage.

You can do what you want, of course, but if you keep on doing what you seem to be doing, keep lots of backups. And remember, if this is the root crontab you can break lots of other things accidentally.

try

crontab -l | [sed expression here]  

to see what you are getting.

Quote thanks for the tip. Not sure why you see this as a problem, can
you elaborate a bit more?

My issue is I want to automate a process through a script and I want
the cron disabled while the script is running. Would this be a better solution?

crontab -l > filename # save cron file
crontab -r # remove cron file
do work
....
....
crontab <file name> # re-instantiate cron

You save a cron file, lets call it cronfile
you do the changes to the file...
you load the new file:

crontab cronfile

Dont forget to be the correct user for the correct cron file you wish to modify/load

(no need to stop cron nore remove...)

Thanks for the follow up.