# Produce test file containing three lines of the same config name/value pair separated
# by variations in one or more space characters which fall into the :blank: character class.
$ PORT=6379; echo -e "port ${PORT}\nport \t${PORT}\nport \t ${PORT}" > redis.port.conf
# Test parse where a successful parse should extract the port number 3 times without extraneous spacing.
# FAIL
$ \grep "^port" /tmp/redis.port.conf | tr -s "[:blank:]" | cut -d" " -f2
6379
6379
# FAIL
$ \grep "^port" /tmp/redis.port.conf | tr "[:blank:]" " " | cut -d" " -f2
6379
$ \grep "^port" /tmp/redis.port.conf | tr "[:blank:]" " " | tr -s "[:blank:]" | cut -d" " -f2
6379
6379
6379
Comments