I want to append
#SB# at the beginning of every line where it matches a given string
sed -i -e'/test1/s/^/#SB#/g' file1 sed -i -e'/test2/s/^/#SB#/g' file1 sed -i -e'/test4/s/^/#SB#/g' file1
/apps/pmserver $ cat file1 00 45 /ser/bat/ab.sh test1 00 45 /ser/bat/ab.sh test2 00 45 /ser/bat/ab.sh test3 00 45 /ser/bat/ab.sh test4 /apps/pmserver $
I am using Korn Shell.
I can output to a new file but it doesn't work if I have more than one
sed statement in a script as shown above. I am getting error
sed: Not a recognized flag: i
What I am trying to do is comment out a few
crontab entries belonging to particular team. test1 test2... are their file names and these need to be turned off.