Curl "write out" value of specific header
You can print a specific header with a single sed or awk command, but HTTP headers use CRLF line endings.
curl -sI stackoverflow.com | tr -d '\r' | sed -En 's/^Content-Type: (.*)/\1/p'
With awk you can add FS=": "
if the values contain spaces:
awk 'BEGIN {FS=": "}/^Content-Type/{print $2}'
The variables specified for "-w" are not directly connected to the http header. So it looks like you have to "parse" them on your own:
curl -I "server/some/resource" | grep -Fi etag