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:

awk '{print $1, $4}' 

  

we would get the following.


bob hello
jim bye

Hope that helps

U4ia-F8

posted on 2010-12-19 17:47  LateStop  阅读(7114)  评论(0)    收藏  举报

导航