CyberTek - the future at the present!
Google

remove comments from a file

Posted by: admin (Jan 17)

Often having to play around a body of configuration files where we can arrange with a handful of parameters. In these cases we can remove all unnecessary fuffa simply using the command below:

# Grep-v "^ #" / etc / my.conf | sed-e'/^$/ d '> / etc / my_new.conf

or you can use this alternative:

# Cat / etc / my.conf | sed '/ * # / d, / ^ * $ / d'> / etc / my_new.conf

Remember my_new.conf to overwrite the original file after checking the contents.

Published in: linux, shell, tips

Add A Comment

Powered by CyberTek - Remote Assistance