Question : how to edit perticuler lines in a file

HI
i am trying to learn shell scripting... after reading coupld of weaks, got basic knowlege ..

suppose, i want to edit /etc/mail/sendmail.mc file by scripting for configuration purpose ...

basic is, the script will ask : insert the smart host options
after typing : mail.mailserver.com
it will goto  line 26 and either it will delete the line  dnl define(`SMART_HOST', `smtp.your.provider')dnl
or some how insert this line define(`SMART_HOST', `mail.mailser.com ')dnl

whts the best way to do this ??

 
#/bin/bash

echo "Insert Smart host"
read Smarthost

if [ -f /etc/mail/sendmail.mc ]
then

how to read for a line ???

else
echo "The file does not exists"

you dont have to give me full thing.. may be some hits... or ( offcourse will hope for full help!!)

Answer : how to edit perticuler lines in a file

sed -i .bak 26d /etc/mail/sendmail.mc
will delete line 26
sed -i .bak "26i\\
define('SMART_HOST', 'mail.mailser.com ')dnl" /etc/mail/sendmail.mc
will insert define('SMART_HOST', 'mail.mailser.com ')dnl
sed -i .bak "/dnl define('SMART_HOST', ;smtp.your.provider')dnl/d" /etc/mail/sendmail.mc
will delete the line dnl define('SMART_HOST', ;smtp.your.provider')dnl
Random Solutions  
 
programming4us programming4us