awk {print $2}的讲解

楼主的提问

 

/oracle/ID1/saparch"|awk '{print $2}'

what does print $2 means?


The print $2 part does this.
===================================================

回答:


Say we have a text file containing the following.

bob 23 45 hello
jim 12 88 bye


If we cat the file and do the awk print $2 thing, we get the following out.


23
12

the print $2 part says to the command, show me the 2nd field.

so, if we said:

 

 

we would get the following.


bob hello
jim bye

Hope that helps

U4ia-F8


版权声明:本文为xueyayang原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。