extract columns from multiple text files with awk -


i trying extract column1 based on values of column2. print values of column1 if column2 ≤30 , greater 5.

i need print total number of values of column1 based on output. how can awk multiple text files?

the sample of text file shown below.

col1   col2    aa     25 bb     4 cc     6 dd     23 aa     30 

the output

aa cc dd aa  total number of aa 2 total number of cc 1 total number of dd 1 

something started:

{ if ($2 <= 30 && $2 > 5) {     print $1     tot[$1] += 1 } } end {    (i in tot) {     print "total number of", i, "is", tot[i]   } } 

output:

$ awk -f i.awk input aa cc dd aa total number of aa 2 total number of cc 1 total number of dd 1 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -