Grep grep -ve ^# -ve ‘^;’ -ve ^$ smb.conf.2103-11-26 > smb.conf Understanding the GREP Filter The command may look a little messy but is really useful to us. -ve ^# : First we remove lines that start with a # -ve ‘^;’ : The we do the same for lines beginning with ; Note the quotes here as the ; has other meanings so we escape the semi-colon in the quotes -ve ^$ : Finally we remove empty lines > : This is used to redirect the output to the new smb.conf. We go from and incredible 333 lines in the original file to a minute 34 lines in the new file. This way, the result is quick and we have not lost out documentation as it is in the backup.