为什么 awk 'print' 语句会忽略我行中的标题?
Why does awk 'print' statement ignore the heading in my line?
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
哪个returns这个:
location: /en-US/docs/Web/API/fetch
我的问题是为什么 awk 'print' 语句忽略 header 并且只打印如下路径:
curl https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch -L -I | grep location | awk '{ print }'
结果:
/en-us/docs/web/api/fetch
你可以试试
awk '{ print [=10=] }'
$2 : 打印第二列
$0 : 打印所有列
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
哪个returns这个:
location: /en-US/docs/Web/API/fetch
我的问题是为什么 awk 'print' 语句忽略 header 并且只打印如下路径:
curl https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch -L -I | grep location | awk '{ print }'
结果:
/en-us/docs/web/api/fetch
你可以试试
awk '{ print [=10=] }'
$2 : 打印第二列 $0 : 打印所有列