去除注释和空行

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

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

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