Troush2009
asked on
How to use sed to replace a pattern out of a file?
How to use sed to replace a pattern out of a file?
Below is the line in rsyslog.conf that I am trying to replace.
*.info;mail.none;authpriv. none;cron. none /var/log/messages
Want to replace it with this line:
*.*;mail.none;authpriv.non e;cron.non e,local1.n one,local2 .none,loca l3.none,lo cal4.none, local5.non e,local6.n one /var/log/messages
try to use sed but can not get it to work correctly. Need some help on the best way to replace this line.
Below is the line in rsyslog.conf that I am trying to replace.
*.info;mail.none;authpriv.
Want to replace it with this line:
*.*;mail.none;authpriv.non
try to use sed but can not get it to work correctly. Need some help on the best way to replace this line.
how do you use sed? like sed -i ?
What exactly do you mean by "can not get it to work correctly"?
ASKER
Below is what I try but could not get it to work.
sed -i 's^/\(.*\).*info;mail.none ;authpriv. none;cron. none /var/log/messages.*/\1*.*, mail.none, authpriv.n one,cron.n one,local1 .none,loca l2.none,lo cal3.none, local4.non e,local5.n one,local6 .none /var/log/messages/' /etc/rsyslog.conf
sed -i 's^/\(.*\).*info;mail.none
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks