Tricks and Tips about Systems/Network

July 21, 2010

How do I delete a word containing lines

Filed under: admins,Bash — Liju Mathew @ 7:22 am

During the mail server setup, I am facing to edit/add the line in between the specified tag containing lines in dovcot (pop3 server). It’s just because of that default configuration files having more than 1000 line and 97% of lines are instructions.

So I would like to remove all the lines begin with the word “#” to get a clean, configuration lines.
# sed -e '/#/d' /tmp/dovecot.conf
#mv /etc/dovecot.conf /etc/dovecot.conf-bk
# cp /tmp/dovecot.conf /etc/dovecot.conf
-sh-3.2# service dovecot restart
Stopping Dovecot Imap: [ OK ]
Starting Dovecot Imap: [ OK ]

Note : Ensure that you have a backup copy before doing this :-)

Theme: Rubric. Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.