The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: awk question..
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-17-2008
nua7 nua7 is offline
Registered User
  
 

Join Date: Mar 2008
Location: /bin/sh
Posts: 353
awk question..

Hi All,
I need to add up values given by the grep command.Following is the sample:

Code:
[root@iqmango ~]# grep cores /proc/cpuinfo
cpu cores       : 4
cpu cores       : 4
cpu cores       : 4
cpu cores       : 4
cpu cores       : 4
cpu cores       : 4
cpu cores       : 4
cpu cores       : 4
I can do this using a for loop , but wanted to know if this could be done in one line to make the code elegant, maybe using awk or some other tool.

Thanks!
nua7