In MDN's command line introduction they print a network response heading to stdout.
curl https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch -L -I | grep location
which returns this:
location: /en-US/docs/Web/API/fetch
My question is why does the awk 'print' statement ignore the header and only print path like below:
curl https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch -L -I | grep location | awk '{ print $2 }'
result:
/en-us/docs/web/api/fetch
CodePudding user response:
you can try
awk '{ print $0 }'
$2 : print the second column $0 : print all columns