This post was updated 581 days ago and some of the ideas may be out of date.

去除注释和空行

grep -v "^#" /etc/redis/redis.conf | grep -v "^$"

去除注释和空行并写入文件

grep -v "^#" /etc/redis/redis.conf | grep -v "^$" > /etc/redis/new_redis.conf