Configuration files can be long and complex and it is hard to see which values have been set. There are numerous ways to do this however, grep with -v (–invert-match) is a quick way to achieve this. The following example removes all the comments from an elasticsearch configuration file:
[email protected]:~$ sudo grep -v '#' /etc/elasticsearch/elasticsearch.yml
cluster.name: es node.name: es01 network.host: 10.1.10.187 discovery.zen.ping.unicast.hosts: ["10.1.10.187", "10.1.10.124"] discovery.zen.minimum_master_nodes: 2
Five lines where it is easy to see what has been configured. Rather than:
[email protected]:~$ sudo wc -l /etc/elasticsearch/elasticsearch.yml 94 /etc/elasticsearch/elasticsearch.yml
So we have removed 89 lines of comments and can review the configuration in five. Time saved!