I would like to ask for help. This is my problem, i am working for a mbs for aix,hp-ux and solaris. And i am making a script that will automatically implement the said mbs.
For example it will automatically change the permmisions of /usr/bin, /etc/passwd and so on. . . .
Now the problem is, cat /etc/inetd
i want that if it will find the word pop3,smtpd and named. it will automatically assign # in the said line.
sed -e 's/pop3/#pop3/g' -e 's/named/#named/g' -e 's/smtpd/#smtpd/g' /etc/inetd
To replace the first occurace only you can do this
sed -e 's/pop3/#pop3/1' -e 's/named/#named/1' -e 's/smtpd/#smtpd/1' /etc/inetd
If you want insert '#' in the line start with smptd,named,pop3 then u can use this
sed -e 's/^pop3/#pop3/1' -e 's/^named/#named/1' -e 's/^smtpd/#smtpd/1' /etc/inetd