As you must be aware that in any configuration file under Linux OS, there is hundreds of lines, most of them are commented with explanations. Therefore going though such files takes time to locate the line we are looking for.
I use the command below to remove all the commented lines and blank lines by combining two commands using pipe '|'. In my case the comments are marked with #.
grep -v "^#" main.cf | grep -v "^$"
The grep -v "^#" filename will remove the commented line.
The grep -v "^$" will remove the blank lines.
I use the command below to remove all the commented lines and blank lines by combining two commands using pipe '|'. In my case the comments are marked with #.
grep -v "^#" main.cf | grep -v "^$"
The grep -v "^#" filename will remove the commented line.
The grep -v "^$" will remove the blank lines.
Comments
Post a Comment