Archive for the ‘sed’ Category

Remove comments from configuration files

Posted: 23rd April 2010 by Valkyrka in bash, one-liner, sed, shell

Here is how you can remove comments ( the ones starting with # ) from configuration files : This will remove all comments from Apache's configuration file.

Removing Ctrl+M characters

Posted: 12th April 2010 by Valkyrka in sed

In order to remove the Ctrl+M characters at the end of the file when moving files from Windows -> Unix, you can do this using sed :

Delete line containing a specific string

Posted: 5th April 2010 by Valkyrka in sed

Here is how you can delete a line which contains a specific string from a file : This will delete the line which contains the string 'string' on it from /var/log/messages.